Welcome to JavaScript and the DOM! You're about to learn how to make web pages interactive and dynamic.
DOM stands for "Document Object Model"—it's how JavaScript sees and interacts with your HTML page.
Engagement Message
What's one everyday website interaction that reacts when you click or type?
Think of the DOM as JavaScript's way of understanding your HTML. When a web page loads, the browser creates a special representation of all your HTML elements.
This representation is what we call the DOM—it's like a map of your entire webpage.
Engagement Message
In a couple of words, how would you describe the DOM?
The DOM organizes your HTML elements in a tree-like structure. Just like a family tree, elements have parents, children, and siblings.
For example, if you have a <div>
containing two <p>
tags, the div
is the parent and the paragraphs are its children.
Engagement Message
Which shape best represents the DOM: a line, a tree, or a circle?
Here's a simple example: Your HTML might have a <body>
tag that contains a <div>
. Inside that <div>
is an <h1>
and a <p>
.
