- The entire document is a document node
- Each HTML element is an element node
- text within an HTML element is a text node
- Each HTML attribute is an attribute node
- Comment is a comment node
- attribute and text nodes belong to the child nodes of the element node, so when you do so, you need to select the element nodes before modifying the properties and text.
Through the HTML DOM, all nodes in the tree can be accessed through JavaScript, all HTML elements (nodes) can be modified, or nodes can be created or deleted.
HTML DOM Methods
CreateAttribute () Creating an attribute node
createelement () Creating ELEMENT nodes
createTextNode () Creating a text node
AppendChild () Adds a new node to the specified node
InsertBefore () Inserts a new child node in front of the specified child node
RemoveChild () Delete child nodes
ReplaceChild () Replace child nodes
GetAttribute () returns the specified property value
SetAttribute () sets the specified property to or modifies the specified value
HTML DOM Properties
InnerHTML gets the text value of the node
The InnerHTML property is useful for getting or replacing the contents of an HTML element
ParentNode Gets the parent node of the node
ChildNodes getting the child nodes of a node
Attributes gets the node's attribute node
FirstChild returns the first child node
JavaScript DOM Node