🔥 $100K Hit! Where Will Bitcoin Go Next? Find Out Live!

Code has been added to clipboard!

Learn to Make jQuery Remove Classes From Elements

Reading time 1 min
Published Jan 23, 2018
Updated Oct 1, 2019

jQuery Remove Class: Main Tips

  • The jQuery .removeClass() deletes the specified class from every matched element.
  • The jQuery remove class method can omit one, several or all classes from elements.
  • It can also be used in XML documents.

Usage of .removeClass()

The jQuery .removeClass() removes the specified classes from HTML elements. The example below is meant to show jQuery remove class specified from the <div> element:

Example
$("button").click(() => {
    $("div").removeClass("introduction");
});

To remove class jQuery syntax goes like this:

$("selector").removeClass(class);

The optional class defines the class to remove. By skipping it, you will make jQuery remove all classes. When removing multiple classes at once, separate them with spaces.

Note: you can also add a function that returns a class to remove.