I am new to this forum, and also quite new to jQuery, so (as I think) the main question, but I could not find the answer, and everything I tried does not work.
I have a button on the page that needs to do certain things and change the class. And with a new class return these things.
This is the code:
$("#info_button.buttonOff").click(function() { $(".content").slideUp(300, function() { $("#info").slideDown(300); $("#info").addClass("contentOn"); $("#info_button").removeClass("buttonOff").addClass("buttonOn"); $("#overlay").fadeIn(300); }); }); $("#info_button.buttonOn").click(function() { $(".content").slideUp(300); $("#info").removeClass("contentOn"); $("#info_button").removeClass("buttonOn").addClass("buttonOff"); $("#overlay").fadeOut(300); });
Only the first event works. But as soon as I add the second event, nothing works. I think I need to do something with .unbind (), but could not figure out how to do it.
Please, help.
source share