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 feature of DOM Level 1 (1998).

All browsers support it:

Chrome IE Edge Firefox Safari Opera
Chrome IE Edge Firefox Safari Opera
Support 9-11 Support Support Support Support