Favorites

DOM DOMTokenList.remove() Method

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
DOMTokenList.remove()
DOM DOMTokenList MethodThis method is supported by all modern browsers.
Updated 28th November 2026

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

<p id="msg" class="note error">Message</p>
const msg = document.getElementById('msg');
msg.classList.remove('error', 'missing-class');
console.log(msg.className);

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.

This method is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee