I have a p
element that when i click i want to change the class of it (from A to B). I can see the class indeed changes but when i click the element it continues to call the action on A not on B.
I though it was because i was doing it dinamically but even using on
i can't get this to work.
<p class='a'>Class is A</p>
$(".a").on("click", function(e){
alert("A");
$(this).removeClass("a");
$(this).addClass("b");
$(this).html("Changed to B");
});
$(".b").on("click", function(e){
alert("B");
});