removeClass() method in jQuery

removeClass() in jQuery

This method is used to remove the single or multiple classes from the specified element.

If the class name is specified the particular class will be removed. But if class name is not specified all the class will be removed.

Syntax 1

$(selector).removeClass(className)

  • className - Name of the classes to be removed from the class attribute of each matched element, and if more than one classes it is separated by space.
Syntax 2

$(selector).removeClass(function(index,currentClass))

  • index - index position of the element in the set.
  • currentClass - Existing class name(s).

Example 1 - remove a class

Try Yourself

Example 2 - remove multiple class

Try Yourself

Example 3 - remove class with function

Try Yourself