HTML DOM Attribute name

Example

Get the name of an attribute:

let aName = element.attributes[0].name;
Try it Yourself »

Description

The name property returns the name of an attribute.

The name property is read-only.


Syntax

attribute.name

Return Value

Type Description
A stringThe name of the attribute.

Browser Support

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

It is fully supported in all browsers:

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


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.