Example

Remove the class "intro" from all p elements:

$("button").click(function(){
  $("p").removeClass("intro");
});

Try it yourself »

Definition and Usage

The removeClass() method removes one or more classes from the selected elements.

Note: If no parameter is specified, this method will remove ALL classes from the selected elements.


Syntax

$(selector).removeClass(classname)

Parameter Description
classname Optional. Specifies one or more class names to remove. To remove several classes, separate the class names with space.

Note: If this parameter is empty, all classes will be removed.


Remove Class Using a Function

Using a function to remove a class from the selected elements.

Syntax

$(selector).removeClass(function(index,oldclass))
Try it yourself »

Parameter Description
function(index,oldclass) A function that returns one or more class names to remove.
  • index - Optional. Receives the index position of the selector
  • oldclass - Optional. Receives the old class value of the selector


Examples

Try it Yourself - Examples

Change the class of an element
How to use addClass() and removeClass() to remove one class, and add a new class.