HTML DOM nameAttribute

属性对象参考手册Attribute Object

Example

Return the attribute name:

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

Output result:

onclick

Try it yourself »

Definition and Usage

The name attribute returns the name of an attribute.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the name attribute.


Syntax

attribute.name

Technical Details

Return value: A string, representing the name of the attribute.
DOM Version Core Level 1


属性对象参考手册Attribute Object

Other Extensions