The hasChildNodes() method returns true if the specified node has any child nodes, otherwise false.
The hasChildNodes() method is supported in all major browsers.
None.
Type | Description |
---|---|
Boolean | Returns true if the specified node has any child nodes, otherwise false |
DOM Version | Core Level 1 Node Object |
---|
The following code fragment loads "books.xml" into xmlDoc using loadXMLDoc() and returns whether the first <book> element has any child nodes:
Output: