HTML DOM Nodes
Element Nodes represent HTML elements in the DOM tree. Each HTML tag in your document corresponds to an Element Node. For example, <div>, <p>, <a>, etc., are all Element Nodes. These nodes have properties and methods that allow you to access and modify their attributes, child nodes, and content. You can retrieve elements using methods like getElementById(), querySelector(), or getElementsByTagName().
Text Nodes represent the text content within an element. They can be found between the opening and closing tags of an element. For example, the text between <p> tags would be a Text Node. Text Nodes can be accessed and modified using the nodeValue property. You can retrieve text nodes by accessing the childNodes property of an element.
Attribute Nodes represent attributes of an element. Each HTML attribute within an element is considered an Attribute Node. For example, the href attribute of an <a> tag would be an Attribute Node. Attribute Nodes can be accessed and modified using properties and methods specific to attributes, such as getAttribute() and setAttribute().
Comment Nodes represent HTML comments within the document. Comments are special markers in the HTML code that are not rendered on the page. Comment Nodes can be accessed and manipulated like other nodes using properties and methods. They are useful for leaving notes or explanations within the HTML code
The Document Node represents the entire HTML or XML document. It serves as the root of the DOM tree. You can access and manipulate the document structure using properties and methods provided by the Document Node.