The Document Object Model (DOM) allows representation of an HTML document as a tree structure as well as allows dynamic access and updating of content, structure, and style of an HTML document.
HTML DOM defines objects and properties of HTML elements and methods to access them. In simpler words, HTML DOM allows standard ways to add, retrieve, change, or delete HTML elements. In the HTML DOM everything is considered as a node:
The entire document is a node called node document
Each HTML element is an element node
Text inside element is a text node
Every attribute in a node is an attribute node
Comment is a comment node
HTML is a mark-up language which defines tags; these tags are associated with each other in a relationship which is shown as following:
Each document has one root element and that does not parent.
A node can have many children but only one parent.
Nodes sharing the same parents are called siblings.
Look...