HTML and CSS Reference
In-Depth Information
explOring attribute nOdes
The
setAttribute()
method sets the
value
of an
attrib
u
te node
attached to
a
n element.
The
getAttribute()
method retrieves the value
of an
attribut
e
node
attached to a
n
element.
To add an attri
b
ute node to
an HTML elem
e
nt, you can
also use the
attribute name
as the node's property name
and the
property value
to
represent the attribute value.