jQuery removeClass

In this post we are learn about jquery removeClass function. usign this function you can add CSS class in HTML any tag. removeClass function you can use with jquery all events like click,change,hover etc..

when you use this function at that time first you add jquery file or cdn. nicesnippets.com provide free source code of jquery removeClass function example with demo code. you can simply copy past in your project. this is simple and best way of removeClass function.

Example Demo


nicesnippets.com For Learning jQuery


Js Code

$('.add_red_color').click(function() {
    $('.live_change').addClass("redcolor");
});

$('.add_red_color').click(function() {
    $('.live_change').removeClass("redcolor");
});

Html Code

<hr>
	<h1 class="live_change" align="center">nicesnippets.com For Learning jQuery</h1>
<hr>

<button class="add_red_color">Add Red Color</button>
<button class="remove_red_color">Remove Red Color</button>

Css Code

.redcolor{
		color:red;
	}
Add