how to add class to element and remove it from other in juery code example
Example 1: jquery remove and add class
$( "#foo" ).toggleClass( 'className', addOrRemoveOptional );
//OR
if ($( "#foo" ).hasClass('className')) {
$( "#foo" ).removeClass( 'className');
} else {
$( "#foo" ).addClass( 'className');
}
Example 2: addclass removeclass jquery
$( "p" ).addClass( "myClass yourClass" );