Home web designing DOM DOM- Definition of Document Object Model or DOM

DOM- Definition of Document Object Model or DOM


What is DOM

The Document Object Model (DOM) is an application programming interface (API) for valid HTML and well-formed XML documents. DOM or document object model in not a programming language . It is style to defines the logical structure of documents . With this logical stucture user can easily access and manipulate content of the webpage .

In the DOM , document is create like a tree structure with root and branches . In the DOM tree structure root is on top side . Just like following image.

DOM Stucture
DOM Structure

DOM Structure

In the DOM specification, the term “document” is used for complete page. For example a html web page start from code <html> and end at tag </html> . All of content and tag are place in a webpage is called document .


Top of tag is called root of document in DOM . As you know , html webpage start with tag <html> . So this tag is called root of Document Object Model . This is also known as Node or parent Node .

In the upper image html tag structure is as follows.

<title>This is the title</title>
<h1> This is the h1 title </h1>
<p> This is paragraph text </p>

In DOM , this html code is divided in well structured format .

First tag is html is parent node or Root of the document . After that head tag and body tag is a directly connected to Html tag so these are known as child of html tag .

Under the head tag title tag is also known as child element and of head . Text that is written in the title, “This is the title ” is also a Node or a child of title tag . This is also Known as Text Node .

Using DOM or Document Object Model , User can easily access and manipulate a specific area of document .