I am trying to operate a toggle class on an element but cannot use the toggleClass facility as the script is running other functions and is being actioned on the classname. Therefore I am using removeClass / addClass. For some reason I cannot get it working. Please find my script below;
$(".view-followers").click(function(){
alert("off");
$(this).removeClass("view-followers");
$(this).addClass("view-followers-on");
});
$(".view-followers-on").click(function(){
alert("on");
$(this).removeClass("view-followers-on");
$(this).addClass("view-followers");
});
or you can view is on jsFiddle; http://jsfiddle.net/dannyj6/UGBda/
Thank you for any help you can provide