HTML Language Question: What Is DOM (Document Object Model)?

Check What Is DOM (Document Object Model)? from Learn HTML section on e akhabaar



The DOM or Document Object Model is the representation of objects and hierarchy in a document which is generally an HTML or XML document. DOM is the skeleton of a document where changes over DOM generally change the document visually.

What Is DOM (Document Object Model)?

DOM provides a structured and hierarchical presentation about the document. DOM is mostly used for Web pages where they contain a lot of different elements related to each other. DOM can be edited by using JavaScript which will reflect the Web page. DOM provides object-oriented presentations for JavaScript where JavaScript objects can be used to manipulate.

DOM Standard

DOM standard is created by W3C in 1998 with the name of Dom Level 1 which provides the complete model for the entire HTML or XML documents. DOM Level 2 is published in 200 where the getElementByID function is introduced. DOM Level 3 is published in 2004 and XPath support and event handling are added. DOM Level 4 was published in 2015 by the WHATWG and W3C.

How To Access DOM?

DOM can be accessed in different ways and tools like JavaScript, Web Browser DOM Editor, etc. But in order to make a change in a reliable way and automize them, JavaScript is the best way. JavaScript stores the complete DOM in the object name document .We can use different properties of the document object to access DOM objects.

document.head
JavaScript document.head

document.body contains the body part of the HTML web page. childElementCount will provide the count of the child elements. document.body.childeren will return all children as HTMLCollection. document.body.firstChild will return the first HTML child element.

JavaScript Document Object

DOM Data Types and Interfaces

In order to use and change DOM with JavaScript, some data types and interfaces are provided.

Document is the complete DOM document where all of the HTML elements can be accessed. document JavaScript object is used to access the Document.

Node is a node in the DOM hierarchy. Nodes are connected to each other hierarchically where some nodes can be other nodes parent or child. The root node is the Document object.

Post your comments about What Is DOM (Document Object Model)? below.