HTML DOM name Property
THE WORLD'S LARGEST WEB DEVELOPER SITE

HTML DOM name Property

❮ Attribute Object

Example

Get the name of an attribute:

var x = document.getElementsByTagName("BUTTON")[0].attributes[0].name;
Try it Yourself »

Definition and Usage

The name property returns the name of the attribute.

This property is read-only.

Tip: You can use the attr.value property to get the value of an attribute.


Browser Support

Property
name Yes Yes Yes Yes Yes

Syntax

attribute.name

Technical Details

Return Value: A String, representing the name of the attribute
DOM Version Core Level 1

❮ Attribute Object