XML DOM hasChildNodes() Method
Element Object
Definition and Usage
The hasChildNodes() method returns TRUE when the current element node has child nodes, otherwise it returns FALSE.
Syntax
elementNode.hasChildNodes()
Example
The following code snippet uses loadXMLDoc() to load "books.xml" into xmlDoc, and check whether the first
Example
xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName("book")[0];
document.write(x.hasChildNodes());
Output:
true
Try it »
Element Object