getAttribute

The getAttribute JS Element returns element’s first attribute whose qualified name is qualifiedName, and null if there is no such attribute otherwise.

Syntax

element.getAttribute(qualifiedName)

Parameters

qualifiedName

A qualified name.

Examples

1 · null

2 · qualifiedName

attachShadow

classList

className

closest

getAttributeNames

getAttributeNS

hasAttribute

hasAttributeNS

hasAttributes

id

innerHTML

insertAdjacentHTML

localName

matches

namespaceURI

outerHTML

prefix

removeAttribute

removeAttributeNS

setAttribute

setAttributeNS

shadowRoot

slot

tagName

toggleAttribute

Web Hypertext Application Technology Working Group (WHATWG)

Home Menu