JavaScript attributes Property Tutorial

In this section, we will learn what the Element attributes property is and how to use it in JavaScript.

What is Element attributes Property in JavaScript?

The JavaScript Element attributes property is used to get a reference to those attributes of an element that are already set (those attributes that have values set for them).

Element attributes Property Syntax:


Element attributes Property Input Value

This property is read-only and so it does not take a value.

Element attributes Property Return Value

The return value of this property is a NamedNodeMap object that contains the entire attributes that are already set for the target element.

Example: get attribute JavaScript

See the Pen get attribute JavaScript by Omid Dehghan (@odchan1) on CodePen.


Top Technologies