freecoding.school100% FREE · NO SIGNUP
The DOM ForestISSUE #1 of 21

the DOM · the document object model

NodetteVSThe Event Bubbler
Nodette saysThe DOM is the live tree of objects representing the page that JS can read and change.

The browser parses HTML into the Document Object Model — a tree of nodes you reach through the global document. Every element, attribute, and text node is an object you can inspect and modify; changes show on screen immediately. DOM scripting is how pages become interactive.

Power-ups you unlock

The Event Bubbler attacks — common mistakes

Boss battleRead document.title and change an element’s text via the DOM.

Example code

<!doctype html><html><head><meta charset="utf-8"><title>DOM</title></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><h1 id="h">before</h1>
<script>document.getElementById('h').textContent='after · title is "'+document.title+'"';</script></body></html>
▶ Open the interactive comic issue
Selecting · QuerySelector · GetElementById ›