Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM name Property

HTML DOM name Property

Attribute Object Reference Attribute object

Example

Returns the attribute name:

document.getElementsByTagName("button")[0].attributes[0].name;

Output result:

onclick

Try it »


Definition and Usage

The name property returns the attribute name.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the name property.


Syntax

attribute

.name

Technical Details

Return Value: A string representing the attribute name.
DOM version Core Level 1

Attribute Object Reference Attribute object