The DOM
Understand the Document Object Model and how JavaScript can change HTML.
What you should understand
Read the lesson carefully, study the example, then use the editor below to experiment with the code yourself.
<!DOCTYPE html>
<html>
<body>
<h2 id="title">Original Text</h2>
<script>
document.getElementById("title").textContent = "JavaScript Changed This!";
</script>
</body>
</html>
Output
See what your code produces.
Test your understanding
Choose the best answer.
Which method can select an element by its ID?