DEV Community

Cover image for DOCUMENT OBJECT MODEL
Vinoth Kumar
Vinoth Kumar

Posted on

DOCUMENT OBJECT MODEL

DOM IN JS:

A structured representation of a web page that allows developers to access, modify, and control its content and structure using JavaScript. It powers most dynamic website interactions, enabling features like real-time updates, form validation, and interactive user interfaces.

TYPES OF DOCUMENT OBJECT MODEL:

  1. Core DOM.
  2. XML DOM.
  3. HTML DOM.

CORE DOCUMENT OBJECT MODEL: All DOM implementations must support the interfaces listed as fundamental in the code specifications.

XML DOCUMENT OBJECT MODEL: As the name suggests, all XML elements can be accessed through the XML DOM .

HTML DOCUMENT OBJECT MODEL: The HTML DOM is a standard for how to get, change, add, or delete HTML elements.

WORKING OF DOCUMENT OBJECT MODEL:

The DOM connects your webpage to JavaScript, allowing you to:

  • Access elements like finding an <h1> tag.
  • Modify content (like changing the text of a

    tag).

  • React to events (like a button click).
  • Create or remove elements dynamically.

PROPERTIES OF DOCUMENT OBJECT MODEL:

  • Node-Based: Everything in the DOM is represented as a node. E.g., element nodes, text nodes, attribute nodes.
  • Hierarchical: The DOM has a parent-child relationship, forming a tree structure.
  • Live: Changes made to the DOM using JavaScript are immediately reflected on the web page.
  • Platform-Independent: It works across different platforms, browsers, and programming languages.

Top comments (0)