HTML DOM : Introduction Guide

  1. DOM is simple and standard way to access and manipulate HTML documents.
  2. DOM presents an HTML document as a tree-structure.
  3. DOM enables us to create documents and parts of documents, navigate through the document, move, copy, and remove parts of the document, and add or modify attributes.
  4. DOM is “Document Object Model”.

Let me explain this with simple example -

<p title="HTML Learning">Learning <b>HTML</b> is not a big task</p>

Above HTML code will be rendered like this in the browser -
DOM HTML

What is DOM ?

  1. DOM means “Document Object Model“.
  2. DOM is used to access HTML and XML documents.
  3. DOM is W3c Standard.
  4. XML DOM is used to access XML document.
  5. HTML DOM is used to access HTML document.
  6. DOM defines the objects and properties of an elements, and the methods to access them.

What we can do using DOM ?

  1. Can Add Element to Document
  2. Can Remove Element from the Document
  3. Can Add attribute to the existing Element
  4. Can Modify or Delete Attribute of Element