See if an element has any childNodes:
The result will be:
The hasChildNodes() method returns true if the specified node has any childNodes, otherwise false.
![]()
The hasChildNodes() method is supported in all major browsers.
None
| Type | Description |
|---|---|
| Boolean | true if the node has childnodes, otherwise false |
| DOM Version | Core Level 1 |
|---|
Node Object
Your message has been sent to W3Schools.