Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons

© 2026 BraveProgrammer. All rights reserved.

  1. Courses
  2. /
  3. JavaScript Course

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';
Previous: Scope, Closures & the Execution ContextNext: Manipulating the DOM – Creation, Insertion & Removal