Document Object Model (DOM)

JavaScript is used to add behavior and interactivity to the web page. It is also possible to manipulate the web page using JavaScript.

JavaScript access the DOM to manipulate the web page. Using DOM, the JavaScript gets access to HTML as well as CSS of the web page and can also add behavior to the HTML elements.

Document Object Model is an API that represents and interacts with HTML document. When a page is loaded, the browser creates the DOM for the web page. The DOM represents the document as a node tree, where each node represents part of the document. It can be an element, text, etc

The DOM represents a document with a logical tree. The tree is a hierarchical structure, in the sense that we have tags inside tags in HTML. For example, in DOM tag is root node, then and tags are it’s children. Like this we have tags inside both and tags as their children.

The DOM represents a document with a logical tree. The tree is a hierarchical structure, in the sense that we have tags inside tags in HTML. For example, in DOM tag is root node, then and tags are it’s children. Like this we have tags inside both and tags as their children.DOM methods allow programmatic access to the tree; with them, you can change the document's structure, style, or content.

what-is-document-object-model-in-JS-featured-image.jpg