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

XML DOM nodeType Property

XML DOM nodeType Property


Document Object Reference Document Object


Definition and Usage

The nodeType property returns the node type of a node.

Syntax

documentObject.nodeType


In all the examples, we use the XML file books.xml and the JavaScript function loadXMLDoc().

Example

The following code snippet displays the node name and node type of the root node:

Example

xmlDoc=loadXMLDoc("books.xml");

document.write("Nodename: " + xmlDoc.nodeName);

document.write(" (nodetype: " + xmlDoc.nodeType);

Output:

Nodename: #document (nodetype: 9)

Try it »


Document Object Reference Document Object