Easy Tutorial
❮ Prop Style Direction Prop Datetime Disabled ❯

HTML DOM attributes Property

Element Object

Example

Get the collection of attributes of an element:

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

Definition and Usage

The attributes property returns a collection of the specified node's attributes.

Tip: You can use the length property to determine the number of attributes, and then you can iterate through all the attribute nodes to extract the information you want.

Tip: Each attribute is available as an attribute node object.


Browser Support

All major browsers support the attributes property.

Note: In Internet Explorer 8 and earlier versions, the attributes property returns a collection of all possible attributes of the element.


Syntax

Technical Details

Return Value: NamedNodeMap object, representing the collection of attributes.
DOM Version Core Level 1 Node Object
--- ---
❮ Prop Style Direction Prop Datetime Disabled ❯