What’s the DOM? #1

Ahmadullahnikzad
2 min readFeb 10, 2021

In this article, I’m going to guide you on what’s DOM and how to work with DOM?

DOM(Document Object Model) is a programming interface for HTML and XML documents. It represents the page so that programs can change the document structure, style, and content. The DOM represents the document as nodes and objects. That way, programming languages can connect to the page.

A web page is a document. This document can be either displayed in the browser window or as the HTML source. But it’s the same document in both cases. The Document Object Model(DOM) represents that same document so it can be manipulated. The DOM is an object-oriented representation of the web page, which can be modified with a scripting language such as JavaScript.

The HTML DOM

When a web page is loaded, the browser creates a Document Object Model of the page.

The HTML DOM model is constructed as a tree of objects.

the HTML DOM as a tree of Objects

With the object model,JavaScript gets all the power it needs to create dynamic HTML.

  1. JavaScript can change all the HTML elements in the page
  2. JavaScript can change all the HTML attributes in the page
  3. JavaScript can change all the CSS styles in the page
  4. JavaScript can remove existing HTML elements and attributes
  5. JavaScript can add new HTML elements and attributes
  6. JavaScript can react to all existing HTML events in the page
  7. JavaScript can create new HTML events in the page

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

In the next series I’m going to write about DOM Methods.

--

--

Ahmadullahnikzad

I am a web developer who writes web development content for you to make web development easier