classList

The classList JS Element allows for manipulation of element’s class content attribute as a set of whitespace-separated tokens through a DOMTokenList object.

Syntax

element.classList

Examples

1 · return

2 · remove

3 · add

4 · toggle

5 · replace

6 · contains

7 · item

8 · [ ]

attachShadow

className

closest

getAttribute

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