-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
  • 921
  • 3
  • 18
  • 36

1 Answers1

5

Add a return false in your jQuery handler

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