bhylu.com

Advertisements

HTML DOM

The DOM represents a page as objects. JavaScript can find an element and update its text after the document is ready.

Where to run this

This example changes a document. Open it in the HTML playground, then select Run code. It runs inside a separate preview.

A practical example

HTML + JavaScript

<p id="message">Waiting</p>
<script>
  const message = document.getElementById("message");
  message.textContent = "Ready for the workshop";
</script>

What happens

The paragraph changes from Waiting to Ready for the workshop.