XML DOM length Property
NodeList object
Definition and Usage
The length property returns the number of nodes in a NodeList.
Syntax
nodelistObject.length
Example
The following code snippet uses loadXMLDoc() to load "books.xml" Load into xmlDoc, and get the
Example
xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName('title');
document.write("Number of title elements: " + x.length);
The code above will output:
Number of title elements: 4
Try it »
Try it Demos
length - Loop through the nodes in a NodeList
NodeList object