Search w3schools.com:

SHARE THIS PAGE

DOM NodeList length Property

NodeList Object Reference NodeList Object

Example

Return the number of child nodes of the body element:

document.body.childNodes.length;

The result could be:

8

Try it yourself »

Definition and Usage

The length property returns the number of nodes in a collection.

A Node object's collection of child nodes is an example of a NodeList object


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The length property is supported in all major browsers.


Syntax

nodelist.length

Technical Details

Return Value: A Number, representing the number of nodes in the nodelist
DOM Version Core Level 1


NodeList Object Reference NodeList Object


Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]