Jquery remove and add back click event

Posted by London on Stack Overflow See other posts from Stack Overflow or by London
Published on 2011-02-02T22:32:33Z Indexed on 2011/02/02 23:26 UTC
Read the original article Hit count: 195

Filed under:
|

Is it possible to remove than add back click event to specific element? i.e

I have a $("#elem").click(function{//some behaviour});, $(".elem").click(function{//some behaviour});(there are more than 1 element) while my other function getJson is executing I'd like to remove the click event from the #elem, and add it again onsuccess from getJson function, but preserve both mouseenter and mouseleave events the whole time?

Or maybe create overlay to prevent clicking like in modal windows? is that better idea?

edit :

I've seen some really good answers, but there is one detail that I omitted not on purpose. There are more than one element, and I call the click function on the className not on elementId as I stated in the original question

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery