DOM DOMTokenList.remove() Method
The remove() method of a DOMTokenList, usually element.classList.remove(), removes one or more classes.
Description
The remove() method removes the given tokens, such as CSS classes, from the list. Tokens that aren't present are ignored, so it's safe to call without checking first.
When the last class is removed, the class attribute stays on the element with an empty value; use removeAttribute('class') if you want it gone completely.
Removing a class is the usual way to undo a state, such as closing a menu or clearing an error highlight. To switch one class for another in a single call, use replace(oldClass, newClass).
Syntax
tokenList.remove(token1, token2, ...)Parameters
- token1, token2, ...One or more tokens (class names) to remove.
Return Value
None (undefined).
Example
Browser Support
The following information will show you the current browser support for the DOMTokenList.remove() method. Hover over a browser icon to see the version that first introduced support for this method.
Desktop





Tablets & Mobile





