ai code academy · Explore coding
What is the DOM in JavaScript?
The Document Object Model, or DOM, represents a web document as connected objects. JavaScript can use this browser interface to read or change page content, structure, and styles.
Discover ai code academyYour next step: guided practice and AI support in the app.
Download on the App Store ↗The page as something a program can change
Imagine a restaurant page where choosing a category changes the dishes shown. The HTML describes the page structure, while the DOM gives a program access to the current document. DOM changes affect that page view; they do not automatically rewrite the original file on the server.
The page has a structure a script can access
The DOM represents a document as connected nodes. A heading, a form field, and a list occupy different places in that structure. JavaScript can work with those parts to reflect information or respond to interaction.
The structure a browser currently shows can differ from the HTML originally delivered by the server. A new list item may appear after an action without a complete page reload. This helps explain the relationship between an initial document and a page that changes during use.
Connect page structure with interaction
The DOM helps explain how a page can respond to people. Explore ai code academy as you build your coding foundation, with current app details available on the App Store.