Get an Address Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Address

Introduction

The Address object represents an HTML <address> element.

You can access an <address> element by using getElementById():

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<address id="myAdr">
Main Street<br>
Box 999, WA<br>
USA/*from  ww w. ja v  a 2 s.co m*/
</address>

<button onclick="myFunction()">Test</button>

<script>
function myFunction() {
    var x = document.getElementById("myAdr");
    console.log(x);
    x.style.color = "red";
}
</script>

</body>
</html>

Related Tutorials