Description
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.
v1.0
This method has the form:
.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. |
Return Value
This form returns a jQuery object.
Remove Class Using a Function
Using a function to remove a class from the selected elements.
v1.4
This method has the alternate form:
.removeClass(function(index,oldclass))
Parameter | Description |
---|---|
function(index, oldclass) |
A function that returns one or more class names to remove.
|
Return Value
This form returns a jQuery object.
Examples
Remove the class "intro" from all p elements:
$("button").click(function(){
$("p").removeClass("intro");
});