0

I have this event handler,

$('#table_product').on 'click', '.th1',(event) ->
       $(this).unbind("click") #Not working

What I'm trying to achieve is when a user triggers this event, it will disable/detach the click event handler from .th1. So it won't give any response to the user for the next request.

Currently, I have tried unbind() and off(), but still no luck.. Any other suggestion ?

Bla...
  • 6,972
  • 6
  • 25
  • 43

2 Answers2

0

First, it could be useful if you give us more code, so we can test the code easily.

From the API of jQuery:

$("#table_product").click(function() {

}

And from the answer of another question on SO:

$('.th1').off('click');

Perhaps this will help?

Community
  • 1
  • 1
-1

Try using "live" to bind the event and use "die" to unbind.

$('#table_product').live( "click", '.th1',(event)

$('#table_product').die( "click", foo );
Sanjay Kumar N S
  • 4,165
  • 3
  • 18
  • 34