Latest web development tutorials

HTML DOM attributes attributes

Elements Object Reference Element object

Examples

Get a set of element attributes:

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

try it"

Definition and Usage

attributes property returns a collection of the specified node attributes.

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

Note: Each property is an attribute node objects are available.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support attributes attributes

NOTE: In Internet Explorer 8 and earlier versions, attributes property returns the set of all possible attribute.


grammar

node .attributes

technical details

return value: NamedNodeMap object that represents a collection of attributes.
DOM version Core Level 1 Node Object


Elements Object Reference Element object