I am trying to remove a class and add a class to divs using jQuery but it doesn't seem to be working.
My html is like this:
<div id="foo">
<div class="row">
<div class="col-sm-4">
<h4>one</h4>
</div>
<div class="col-sm-4">
<h4>two</h4>
</div>
</div>
</div>
I would like to remove the class col-sm-4 and instead add class col-sm-6
This is what I've done:
$("#foo").find(".col-sm-4").addClass(".col-sm-6").removeClass(".col-sm-4");
I've ensured that I am getting elements back by find
alert($("#foo").find(".col-sm-4").length); //2
Even though I'm not getting any errors, there is no change in my elements.
.in theaddClass()and similar methods. I myself make this error all the time.