XML DOM hasChildNodes () method
Definition and Usage
hasChildNodes () method returns TRUE if the current element node has child nodes, otherwise it returns FALSE.
grammar
elementNode.hasChildNodes()
Examples
The following code fragment uses loadXMLDoc () to " the Books.xml " into xmlDoc, and check if the first <book> element has child nodes:
Examples
xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName("book")[0];
document.write(x.hasChildNodes());
x=xmlDoc.getElementsByTagName("book")[0];
document.write(x.hasChildNodes());
Output:
true
try it"
Element object