LOGBOOK

HELP

1 / 29
Other keys: showSpace: good1-4: rate0: skip5: flag6: invert

Question

What is the DOM (Document Object Model)?

Answer

The DOM is a live, tree-structured representation of an HTML document that the browser builds so JavaScript can read and modify page content.

When a browser loads HTML, it parses it into a hierarchical tree structure where:

  • Each HTML element becomes a node in the tree
  • The tree starts with the document object as the root
  • Parent-child relationships mirror HTML nesting

Key characteristics:

  • Live representation - Changes to the DOM immediately reflect on the page
  • Language-neutral interface - Though typically used with JavaScript
  • Standardized by W3C - Consistent across browsers

Example structure:

document
└── html
    ├── head
    │   └── title
    └── body
        ├── h1
        └── p

Tip: Think of the DOM as the "living" version of your HTML that JavaScript can read and modify.

Go deeper:

Illustration
‍Birger Eriksson · CC BY-SA 3.0 · Wikimedia Commons
or press any other key