X
HOME HTML5 CSS3 JAVASCRIPT SQL PHP5 JQUERY ANGULAR BOOTSTRAP3 XML MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

HTML DOM name Property

Attributes Object Reference Attribute Object

Example

Get the name of an attribute:

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

The result of x will be:

onclick

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


Attributes Object Reference Attribute Object


Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook