Document Object Model (DOM) in JavaScript
Document Object Model (DOM)
When the HTML page is loaded and rendered visually on the screen. The browser builds the Document Object Model of that page, which is its logical structure.
Further Explanation:-
We can use JavaScript to manipulate the DOM of the page dynamically. The DOM represents a document as a tree structure. HTML elements become interrelated nodes in the tree. All of the nodes have some relations between them. Nodes on the same level are called siblings.
There is a predefined document object in JavaScript, which can be used to access all elements on the DOM. If you want to access objects on an HTML page, you always start with accessing the document object.
Example:-
A body is an element of the DOM. We can change its value by just accessing the document object like document.body
DOM diagram is:-