How to recognize the second click on the button
1 answer
You can use .toggle() , for example:
$("#myButton").toggle(function() { //click oe }, function () { //click two }); You can add as much as you want, in fact, it just goes through them. If you need to bomb after the second click, simply .unbind() by adding $(this).unbind('click') at the bottom of the last click function, for example:
$("#myButton").toggle(function() { //click oe }, function () { //click two $(this).unbind('click'); //without this, it goes back to the first function //on the next click }); +5