Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

XML DOM parentNode Property

XML DOM parentNode Property


Node Object Reference Node object


Definition and Usage

The parentNode property returns the parent node of a node.

Syntax

nodeObject.parentNode


Example

The following code snippet uses loadXMLDoc() to load "books.xml" into xmlDoc, and return whether the first parent node of the element: </p>

Example

xmlDoc=loadXMLDoc("books.xml");

x=xmlDoc.getElementsByTagName("title")[0];

document.write("Parent node: " + x.parentNode.nodeName);

The code above will output:

Parent node: book

Try it »


Node Object Reference Node object