Favorites

DOM Node.parentNode Property

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Node.parentNode
DOM Node PropertyThis property is supported by all modern browsers.
Updated 28th November 2026

The parentNode property returns the parent of a node in the DOM tree.

Description

The read-only parentNode property returns the node's parent, which can be an element, the document or a document fragment. It's null for nodes that haven't been added to the page. parentElement is similar but returns null when the parent isn't an element. To find a specific ancestor, closest() is usually more convenient.

Because the property is read-only, you move a node to a new parent by inserting it there with a method such as append(). To walk up through every ancestor, repeat node = node.parentNode until it's null.

Inside a shadow root, the top element's parentNode is the shadow root itself, not the host element; use the shadow root's host property to step out to the element it's attached to.

Syntax

node.parentNode

Value

The parent node, or null if the node has no parent.

Example

<ul><li>Item</li></ul>
const item = document.querySelector('li');
console.log(item.parentNode.tagName);
console.log(document.documentElement.parentNode === document);
console.log(document.createElement('div').parentNode);

Browser Support

The following information will show you the current browser support for the Node.parentNode property. Hover over a browser icon to see the version that first introduced support for this property.

This property is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee