<div class="a b"></div>
Say, I want to change it to:
<div class="a"></div>
And reversely, how to add class "b" to a div
with class "a"?
<div class="a b"></div>
Say, I want to change it to:
<div class="a"></div>
And reversely, how to add class "b" to a div
with class "a"?
To remove it:
$(".a.b").removeClass("b");
To add it:
$(".a").addClass("b");
To change "a b" to just "a":
$('.a.b').removeClass('b');
To add class "b" to divs with class "a":
$('.a').addClass('b');
Try this for your first question:
$('div').filter('.a, .b').removeClass('b');
and this for your second question:
$('div.a').addClass('b');