Nearby lessons

1 of 14

HTML DOM (Document Object Model)

🌳 What is the HTML DOM?

The HTML DOM is a programming interface for HTML and XML documents. When a web page is loaded, the browser creates a Document Object Model of the page, structured as a tree of objects that represent HTML elements. JavaScript uses the DOM to interact with and manipulate the content, structure, and styles of the page.

📋 DOM Tree Structure

The HTML DOM (Document Object Model) represents the structure of HTML documents as a tree of objects. Each element becomes a node in this tree, allowing JavaScript to access and modify the page dynamically.

Code Example
PREVIEW READY
Loading Editor...
Live Preview

⚙️ JavaScript Capabilities with the DOM

Using the DOM, JavaScript can:

  • Change all HTML elements
  • Change HTML attributes
  • Modify CSS styles
  • Remove or add HTML elements and attributes
  • Respond to existing events
  • Create new events

📘 W3C DOM Standard

The DOM is defined by the W3C as a standard for accessing and manipulating documents. It is a platform and language-neutral interface that lets scripts dynamically update the content, structure, and style of a document.

🔗 Three Parts of the DOM Standard

  • Core DOM – Standard model for all document types
  • XML DOM – Standard model for XML documents
  • HTML DOM – Standard model for HTML documents

🧠 HTML DOM Definition

The HTML DOM defines:

  • HTML elements as objects
  • The properties of all HTML elements
  • The methods to access all HTML elements
  • The events for all HTML elements

🧠 Test Your Knowledge

3 Questions

Progress: 0 / 3
Keep Going!JavaScript DOM Methods