Latest web development tutorials

HTML DOM name attribute

Property Object Reference Attribute object

Examples

Returns the name of the property:

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

Output:

onclick

try it"

Definition and Usage

name property returns the attribute name.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support attribute name


grammar

attribute .name

technical details

return value: String representing the name of the property.
DOM version Core Level 1


Property Object Reference Attribute object