<tab>
<div class="switchLeft"></div>
.switchLeft
{
}
.switchRight
{
}
js code
$("div.switchLeft").click(function () {
if (className == "switchRight") {
$(this).removeClass("switchRight");
$(this).addClass("switchLeft");
}
else if (className == "switchLeft") {
$(this).removeClass("switchRight");
$(this).addClass("switchRight");
break;
}
});
but else if here in after,switch is working again and switchRight removing
thank you
To access class you can use
this.classNameor it should be$(this).attr('class')With this.className