Lesson 8 of 55 · javascript
The Document Object Model (DOM)
Duration: 12 mins
The DOM is a tree‑like representation of the HTML document.
document– entry point.document.querySelector()/querySelectorAll()– CSS selector based retrieval.document.getElementById(),getElementsByClassName(),getElementsByTagName()– legacy methods.
Node types: Element, Text, Comment, DocumentFragment.
Example: Selecting and modifying an element
const title = document.querySelector('h1');
title.textContent = 'Updated Title';
title.style.color = '#0066cc';