HTML DOM Attributes name attribute

Definition and usage

name The attribute returns the name of the attribute.

name The attribute is read-only.

See also:

attribute.value attribute

Instance

Get the name of the attribute:

let aName = element.attributes[0].name;

Try it yourself

Syntax

attribute.name

Return value

Type Description
String The name of the attribute.

Browser support

attribute.name It is a DOM Level 1 (1998) feature.

All web browsers support it:

Chrome IE Edge Firefox Safari Opera
Chrome IE Edge Firefox Safari Opera
Stöd 9-11 Stöd Stöd Stöd Stöd