DOM for JavaScripts
The DOM, or Document Object Model, is the tree of objects the browser builds from HTML, which JavaScript can read and change. This unit in the In the Browser stage covers selecting elements, updating text and attributes, creating nodes and reacting to events such as clicks, input and form submission.
Stage: In the Browser · Part of the JavaScript roadmap · Last reviewed 19 November 2026
What to learn in DOM
- Select elements with querySelector and querySelectorAll
- Update text, classes and attributes of an element from script
- Create and insert new elements into the page safely
- Attach an event listener and read the event object
- Use event delegation to handle clicks on many list items with one listener
DOM interview questions
What is event delegation and why is it useful?
Event delegation attaches one listener to a parent and uses event bubbling to handle events from its children, checking event.target. It saves memory and also works for elements added later, which is handy for dynamic lists.
What is the difference between textContent and innerHTML?
textContent sets or reads plain text and is safe from injected markup. innerHTML parses a string as HTML, which is flexible but risky if the string contains user input, because it can enable cross-site scripting attacks.
Where DOM fits in the JavaScript roadmap
DOM belongs to the In the Browser stage (intermediate level), which takes about 28 hours. Build interactive pages.
Other units in this stage
Back to the full JavaScript roadmap