Node: parentNode property - Web APIs | MDN
Value
A Node that is the parent of the current node. The parent of an element is
an Element node, a Document node, or a DocumentFragment node.
Example
Using parentNode
This example removes a node from the tree, unless it's not in the tree already.
js
if (node.parentNode) {
node.parentNode.removeChild(node);
}
Specifications
| Specification |
|---|
| DOM # ref-for-dom-node-parentnode① |