HTML DOM length property
Examples
Back body element number of child nodes:
document.body.childNodes.length;
Output:
8
try it"
Definition and Usage
length property returns the number of nodes in the collection.
Child nodes of the node object is an instance of a node list object.
Browser Support
All major browsers support length property
grammar
nodelist.length
technical details
return value: | Returns the number that represents the number of nodes in the node list. |
---|---|
DOM version | Core Level 1 Nodelist Object |