-2

Possible Duplicate:
jquery - disable click

How can I prevent a click event of a button's selector when is pushed? If there are some buttons. I want to lock the event of the button pushed. I have tried with:

event.stopImmediatePropagation(); 
event.stopPropagation(); 
event.preventDefault();

But it does not work.

Edit: I haven't provided the code because is backbone code and this isn't a theme of that theme. If I have a list of buttons in a menu, and I press one multiple times, the code associated a that button is run multiple times. I want to lock this click event and unlock it if other button is pushed.

Solution:

//disable
$("#button").bind('click', function() { return false; });

//enable
$("#button").unbind('click');
Community
  • 1
  • 1
vicenrele
  • 971
  • 3
  • 19
  • 37

1 Answers1

5

Add a return false in your jQuery handler

$("#button").click( function () {
   return false;
}
Wolf
  • 2,150
  • 1
  • 15
  • 11