.removeClass() removes one or more CSS class names from each matched element (since jQuery 1.0). Named classes are stripped; others stay. With no arguments, every class is cleared.
Select elements, pass class names to strip (or none to clear all), then chain if needed.
Select the element(s) with a jQuery selector.
Call .removeClass("name") — or a space list / array / callback.
Omit arguments only when you truly want every class gone.
Chain freely — .removeClass() returns the same jQuery object.
Piece
Required?
Role
jQuery collection
Yes
Elements to update
className / array / function
Optional
What to strip; omit = remove all
Return
—
Same jQuery object (chainable)
Pseudocode
Pseudocode
for each matched element:
if no argument:
clear entire class attribute
else:
names = resolve (string | array | function)
for each class in names:
remove it if present
// Official idea:
$("p").even().removeClass("blue")
// even-index paragraphs lose "blue"; other classes stay
Reference
Cheat Sheet
Keep these facts handy while stripping classes.
Topic
Detail
Syntax
.removeClass(className) or .removeClass()
Since
jQuery 1.0 (array form: 3.3+)
Multiple
Space string or ["a", "b"]
Callback
function(index, className) since 1.4
No args
Removes all classes
Missing name
Safe no-op for that name
SVG / XML
Supported since jQuery 1.12 / 2.2
Try it
Live Preview
Start from class="blue under highlight", run a remove action, and inspect the updated class attribute.
Sample
Browser demo of .removeClass() — same idea as the examples below.
Result
class before: "blue under highlight"
$("p").removeClass("blue")
class after: "under highlight"
Code
jQuery Examples
Short, copy-ready snippets. Open DevTools Console, or use Try It Yourself for a live editor.
Per element. jQuery calls the function for the last <li>.
Return value. Previous sibling’s class string is "beta".
Strip. That name is removed from the last item.
Keep.alpha and gamma were not returned, so they stay.
Edge Cases & Pitfalls
Check these before clearing classes in UI code.
all
Empty call removes everything
.removeClass() with no args is powerful — and easy to overuse. Prefer named removals when possible.
dot
No CSS selector dot
Write removeClass("active"), not removeClass(".active").
replace
Replace ≠ remove then guess
To set an exclusive class list, use .attr("class", "new") or removeClass().addClass() with known names.
missing
Missing names are fine
Removing a class that is not present does not throw — jQuery simply skips it.
Compatibility
Browser Support
.removeClass() is a core jQuery method (since 1.0). It needs a browser DOM with jQuery loaded. Array overload needs 3.3+. SVG/XML updates are solid since 1.12/2.2.
✓ jQuery 1.0+ · Browsers only
jQuery .removeClass()
Works in Chrome, Firefox, Safari, Edge, and other browsers with jQuery. Not for Node.js without a DOM.
100%Browser support
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
.removeClass()Browsers
Bottom line: Use .removeClass() in the browser. Prefer named removals; reserve the no-arg form for a full clear.
Analysis
Performance Notes
Approach
Cost
Best for
.removeClass("x")
Low
Turning off one UI state
.removeClass() (all)
Low
Full reset of class list
Native classList.remove
Lowest
Hot paths without jQuery
Class changes are cheap compared with layout thrashing. Prefer named removals over clearing everything when you only need one state gone.
Remember
Key Takeaways
Role:.removeClass() strips class names; others stay.
Many at once: space string or array (3.3+).
No args: clears every class on each match.
Switch: chain with .addClass() for exclusive states.
One line: use .removeClass() to turn stylesheet states off — named removals by default, empty call only for a full clear.
Frequently Asked Questions
.removeClass() strips one or more CSS class names from each matched element. Other classes stay. With no arguments, it removes every class from each match.
.removeClass() with no args clears the entire class attribute on every matched element. Use sparingly. To replace all classes with one new name, prefer .attr('class', 'newClass').
Yes. Pass a space-separated string — removeClass('blue under') — or since jQuery 3.3 an array — removeClass(['blue', 'under']).
Since jQuery 1.4 you can pass function(index, className). jQuery calls it once per element and removes the returned class name(s). Since 3.3 the callback may return an array.
.removeClass() always strips. .addClass() always appends. .toggleClass() flips presence. Chain removeClass().addClass() to switch exclusive states.
Yes, since jQuery 1.12/2.2 it updates the class attribute and supports SVG and XML elements.