Name
getAttribute( ) — NN n/a IE 4 DOM n/a
Synopsis
getAttribute(attributeName[,
caseSensitivity])
Returns the value of the named attribute within the current element.
If the attribute is reflected in the object model as a property, this
method returns the same value as when reading the object’s
property. If the tag includes multiple attributes with the same name
(and caseSensitivity is not turned on),
the last one in order is used to retrieve the value.
Returned Value
Attribute value as a string, number, or Boolean, as dictated by the attribute’s data type.
Parameters
-
attributeName The attribute name used in the HTML tag (not including the
=symbol).-
caseSensitivity An optional Boolean value. If
true, the attribute in the HTML tag must match the case of theattributeNameparameter exactly for its value to be returned.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access