Latest web development tutorials

jQuery removeClass () method

jQuery HTML / CSS Methods jQuery HTML / CSS Methods

Examples

Removed from all of the <p> element "intro" category:

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

try it"

Definition and Usage

removeClass () method to remove one or more classes from the selected elements.

Note: If theparameter is not specified, the method will delete the selected element in all the classes.


grammar

$(selector).removeClass(classname,function(index,currentclass))

参数 描述
classname 可选。规定要移除的一个或多个类名称。如需移除若干个类,请使用空格分隔类名称。

注意: 如果该参数为空,则将移除所有类名称。
function(index,currentclass) 可选。返回要移除的一个或多个类名称的函数。
  • index- 返回集合中元素的 index 位置。
  • currentclass- 返回被选元素的当前类名。


Examples s

More examples

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

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

Remove several class name
How do you remove a number of selected elements from the class name.


jQuery HTML / CSS Methods jQuery HTML / CSS Methods