HTML DOM lengthProperty
Example
Return the number of attributes of the button element:
document.getElementsByTagName("BUTTON")[0].attributes.length;
Output:
1
Try it Yourself »
Definition and Usage
The length property returns the number of nodes in the collection.
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the length property.
Note:In Internet Explorer 8 and earlier IE versions, the length property returns the number of all possible attributes of an element.
Syntax
namednodemap.length
Technical Details
| Return value: | A number, representing the number of nodes. |
|---|---|
| DOM Version | Core Level 1 |
Other Extensions
Property Object