HTML DOM nameAttribute
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
![]()
![]()
![]()
![]()
![]()
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 |
Other Extensions
Attribute Object