So I have a couple of divs with a class "turn". Then in Jquery I have
$(".turn").click(function(){
...some code...
if (..) $(this).removeClass("turn");
});
which I expect to remove the handler, so I can't click on it anymore. But I still want to be able on the other divs that has that class. This is not working (I believe is because JQuery doesn't remove the handlers when a class is removed) I've also tried with
$('.turn?).live(click,...) and $(this).die()
and
$('.turn?).bind()/$(this).unbind()
But neither of those seems to work. Can I get some hint about how to do this? Thanks
The correct method for this is to use unbind
$(".turn").click(function(){
...some code...
if (..) $(this).unbind("click");
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With