I’m trying to toggle a class of “on” with jquery, but doesn’t seem to be working. addClass does work, so I’m not sure what I’m doing wrong?
this works:
$(".request-trial").click(function () {
$("#request-trial").addClass("on");
});
but this does not:
$(".request-trial").click(function () {
$("#request-trial").toggleClass("on");
});
Any help would be appreciated..!
It works for me, though i’m guessing you didn’t mean
#request-trialinside the click event and instead need either$(this)or$(".request-trial")http://jsfiddle.net/hXxjY/