In javascript, there is a node in the document
parentNode – parent node
firstChild - the first child node
lastChild - the last child node
previousSibling—The brother node next to the front
nextSibling—The next brother node next to it
Five related nodes, these nodes may not exist, are null. For example, the document does not contain the parent node, and the text node (TextNode) does not contain the child node.
This allows you to make short trips and access certain related nodes of the current node.
There are also childNode[] (including all child nodes) and children[] (including only child nodes of type element nodes, not text node textNode).
parentNode – parent node
firstChild - the first child node
lastChild - the last child node
previousSibling—The brother node next to the front
nextSibling—The next brother node next to it
Five related nodes, these nodes may not exist, are null. For example, the document does not contain the parent node, and the text node (TextNode) does not contain the child node.
This allows you to make short trips and access certain related nodes of the current node.
There are also childNode[] (including all child nodes) and children[] (including only child nodes of type element nodes, not text node textNode).