HTML DOM Address Object

HTMLWeb DevelopmentFront End Technology

Use the address object to represent the <address> element. Let us see an example to create <address> −

Example

 Live Demo

<!DOCTYPE html>
<html>
<body>
<h2>Heading Two</h2>
<p>Create address element</p>
<button onclick="display()">Display</button>
<script>
   function display() {
      var a = document.createElement("Address");
      var node = document.createTextNode("ABC Inc, P 120, Ontario, Canada");
      a.appendChild(node);
      document.body.appendChild(a);
   }
</script>
</body>
</html>

Output

Now, click on the button to display the address −

raja
Published on 21-Jun-2019 16:05:50
Advertisements