Using the jQuery removeClass() method deletes one or more specified classes in the selected HTML elements.
It can also be used in XML language.
Syntax:
By combining the addClass() and removeClass() methods, it is possible to replace the classes wich assigned to the elements.
code:
<!DOCTYPE html>
<html>
<head>
<title>IT PRESENT</title>
<style>
.a {
background-image: url("images/honeycomb.jpg");
}
.b {
color:blue;
-webkit-text-stroke: 2px red;
}
.c {
color:maroon;
text-shadow: 2px 1px 0px orange;
}
.d {
background-color:lime;
color:red
}
</style>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
</head>
<body>
<div id="content" class="a">
<h1 class="b">JQUERY TUTORIAL</h1>
<h2 class="c">removeClass() method</h2>
<h3 class="d">Javascript Language</h3>
<button>CLICK HERE</button>
</div>
<script>
$(document).ready(function(){
$("button").click(function(){
$("#content").removeClass("a");
$("h1").removeClass("b");
$("h2").removeClass("c");
$("h3").removeClass("d");
});
});
</script>
</body>
</html>
result: