HTML DOM length Property
Example
Return the number of child nodes of the body element:
document.body.childNodes.length;
Output result:
8
Try it »
Definition and Usage
The length property returns the number of nodes in a collection.
The child node collection of a node object is an instance of a node list object.
Browser support





All major browsers support the length property.
Syntax
nodelist
.length
Technical Details
| Return Value: | Returns a number that represents the number of nodes in a node list. |
|---|---|
| DOM version | Core Level 1 Nodelist Object |
Element object