1Basic Syntax:
2$(element).removeClass( "myClass yourClass" )
3-------------------------------------------------------------------------------------
4
5Html code example:
6<p class="red highlight">test1</p>
7<p class="red highlight marked">test2</p>
8<p class="red highlight">test3</p>
9<p class="red highlight">test4</p>
10
11// remove all highlight class from p tag
12<script>
13 $( "p" ).removeClass( "highlight" )
14</script>
15
16// output after execution of this code
17<p class="red">test1</p>
18<p class="red marked">test2</p>
19<p class="red">test3</p>
20<p class="red">test4</p>
21
1//Remove this same line after copying
2Basic Syntax:
3$(element).removeClass( "myClass yourClass" )
4-------------------------------------------------------------------------------------
5
6Html code example:
7<p class="red highlight">test1</p>
8<p class="red highlight marked">test2</p>
9<p class="red highlight">test3</p>
10<p class="red highlight">test4</p>
11
12// remove all highlight class from p tag
13<script>
14 $( "p" ).removeClass( "highlight" )
15</script>
16
17// output after execution of this code
18<p class="red">test1</p>
19<p class="red marked">test2</p>
20<p class="red">test3</p>
21<p class="red">test4</p>
1$( "#foo" ).toggleClass( 'className', addOrRemoveOptional );
2
3//OR
4if ($( "#foo" ).hasClass('className')) {
5 $( "#foo" ).removeClass( 'className');
6} else {
7 $( "#foo" ).addClass( 'className');
8}
9
1$("button").click(function(){
2 $("p").removeClass("intro");
3 });
4//Html code example:
5<p class="red highlight">test1</p>
6<p class="red highlight marked">test2</p>
7<p class="red highlight">test3</p>
8<p class="red highlight">test4</p>
9
10// remove all highlight class from p tag
11<script>
12 $( "p" ).removeClass( "highlight" )
13</script>
14// example $(element).removeClass( "myClass yourClass" )
1$("#div1").on("click", function () {
2 if ($(this).hasClass("active")) {
3 setTimeout(function () {
4 $("#div1").removeClass("active");
5 }, 10);
6 }
7 });