Search w3schools.com:

SHARE THIS PAGE

DOM NamedNodeMap length Property

NamedNodeMap Object Reference NamedNodeMap Object

Example

Return the number of attributes of a button element:

document.getElementsByTagName("BUTTON")[0].attributes.length;

The result could be:

1

Try it yourself »

Definition and Usage

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

A Node object's attributes is an example of a NamedNodeMap object


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The length property is supported in all major browsers.

Note: In Internet Explorer 8 and earlier, the length property for attributes will return the number of all possible attributes for an element.


Syntax

namednodemap.length

Technical Details

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


NamedNodeMap Object Reference NamedNodeMap Object


Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]