- Instant help with your JavaScript coding problems
DOMTokenList.add
The add() method of the DOMTokenList interface adds the given tokens to the list, omitting any that are already present.
JavaScript:
add(token0);
TypeScript:
add(...tokens: string[]): void;
Examples:
myElement.classList.add("my-class-1", "my-class-2");

Related snippets