The id Attribute: Using The id Attribute in JavaScript

Using The id Attribute in JavaScript

<script>
function displayResult() {
  document.getElementById("myHeader").innerHTML = "Have a nice day!";
}
</script>

JavaScript can access an element with a specified id by using the getElementById() method.

Related concepts

Using The id Attribute in JavaScript

The id Attribute: Using The id Attribute in JavaScript — Structure map

Clickable & Draggable!

The id Attribute: Using The id Attribute in JavaScript — Related pages: