HTML DOM hasChildNodes method
Examples
See all the child nodes of an element:
document.getElementById("myList").hasChildNodes()
Output:
true
try it"
Definition and Usage
hasChildNodes () method returns true when a node for any child nodes, otherwise it returns false.
Browser Support
All major browsers support hasChildNodes () method
grammar
node.hasChildNodes()
parameter
None
return value
类型 | 描述 |
---|---|
Boolean | 如果节点有子节点则返回true ,否则返回false。 |
technical details
DOM version | Core Level 1 Node Object |
---|