X
HOME HTML5 CSS3 JAVASCRIPT SQL PHP5 JQUERY ANGULAR BOOTSTRAP3 XML MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

HTML DOM parentNode Property

Element Object Reference Element Object

Example

Get the node name of the parent node of a <li> element:

var x = document.getElementById("myLI").parentNode.nodeName;

The result of x will be:

UL

Try it yourself »


Definition and Usage

The parentNode property returns the parent node of the specified node, as a Node object.

Note: In HTML, the document itself is the parent node of the HTML element, HEAD and BODY are child nodes of the HTML element.

This property is read-only.


Browser Support

The numbers in the table specify the first browser version that fully supports the property.

Property
parentNode 1.0 Yes 1.0 Yes Yes


Syntax

node.parentNode

Technical Details

Return Value: A Node object, representing the parent node of a node, or null if the node has no parent
DOM Version Core Level 1 Node Object


Related Pages

HTML DOM reference: node.childNodes Property

HTML DOM reference: node.firstChild Property

HTML DOM reference: node.lastChild Property

HTML DOM reference: node.nextSibling Property

HTML DOM reference: node.previousSibling Property

HTML DOM reference: node.nodeName Property

HTML DOM reference: node.parentElement Property


Element Object Reference Element Object


Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook