JQuery RemoveClass()

jQuery removeClass() method is the used to remove a single class, multiple classes, or all classes from each element in the set of matched elements..

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

Below the syntax of removeClass().

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

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 class names will be removed
function(index,currentclass) Optional. A function that returns one or more class names to remove
  • index - Returns the index position of the element in the set
  • currentclass - Returns the current class name of selected elements
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery removeClass()</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<style>
.highlight{font-size:18px;color:#11a286}
</style>
<script>
$(document).ready(function() {
  $("#button").click(function() {
     $("p").removeClass('highlight');
  });
});
</script>
</head>
<body>
 <p class="highlight">This is a paragraph.</p>
 <button style="margin:0 0 10px 0;background:#e8e8e8;" class="btn" id="button">Click here to remove class from p element</button><br />
 </body>
</html>