XML DOM hasChildNodes() Method
Complete Node Object Reference
Definition and Usage
The hasChildNodes() method returns true if a node has any child
nodes, otherwise it returns false.
Syntax
nodeObject.hasChildNodes()
|
Example
The following code fragment loads "books.xml"
into xmlDoc using
loadXMLDoc() and returns whether the first <book> element has any
child nodes:
xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName("book")[0];
document.write(x.hasChildNodes());
|
Output:
Try-It-Yourself Demos
hasChildNodes() - Checks if an element has any child nodes
Complete Node Object Reference
|
|
|
See why there are 20,000+ Ektron integrations worldwide.
Request an INSTANT DEMO or download a FREE TRIAL today. |
|
|
|