Latest web development tutorials

XML DOM nodeType property

Document Object Reference Document Object

Definition and Usage

nodeType property returns the node type node.

grammar

documentObject.nodeType


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

Examples

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

Examples

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