🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to JavaScript Notes
Topic #140

JS HTML DOM

HTML Document Object Model

The HTML DOM (HTML Document Object Model) is an Object Model for HTML Documents.

DOM HTML tree

The HTML DOM is a tree of Nodes that represents an HTML Page.


The DOM Tree

When a web page loads, the browser creates a tree-like representation of the HTML document.

Each part of the document are nodes in the tree:

Col 1 Col 2
Node Description
Document Owner of all nodes in the document
Element Node
Element Node
Element Node
Element Node
href Attribute Node

Element Node
My Header Text Node

Accessing HTML Elements

The HTML DOM can be used to access HTML elements.

The most common way to access an HTML element is to use the id of the element:

Example

<html>

<body>

<p id="demo"></p>

<script>

// Access a paragraph Element

const myPara = document.getElementById("demo");

// Change the content of the Element

myPara.innerHTML = "Hello World!";

</script>

</body>

</html>

In the example above, the getElementById method used id="demo" to find the element.

  • id="demo" is an HTML property
  • getElementById() is a DOM Method
  • innerHTML is a DOM Property

What You Will Learn

In the next chapters of this tutorial you will learn:

  • How to change the content of HTML elements
  • How to change the style (CSS) of HTML elements
  • How to add and delete HTML elements
  • How to react to events in from HTML elements

The World Wide Web Consortium

The DOM is a W3C Standard (World Wide Web Consortium):

"The W3C Document Object Model (DOM) is a platform and language-neutral interface that allows programs and scripts to dynamically access and update the content, structure, and style of a document."

The W3C DOM standard is separated into 3 different parts:

  • Core DOM - standard model for all document types
  • XML DOM - standard model for XML documents
  • HTML DOM - standard model for HTML documents

Note: The HTML DOM is a language independent standard developed by the W3C and WHATWG.

Want to go beyond the notes?

Join CodingNow 2.0's JavaScript course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

JS HTML DOM – FAQs

Quick answers about learning JS HTML DOM in JavaScript.

This free note from CodingNow 2.0 explains JS HTML DOM in JavaScript — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every JavaScript topic on CodingNow 2.0, including JS HTML DOM, is 100% free with no signup required.
With focused practice, most students grasp JS HTML DOM in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now