Sunday, 18 August 2013

Turning all events .off() and .on() in jQuery

Turning all events .off() and .on() in jQuery

I'm looking at using .off() and .on() to turn event handlers off and on in
jQuery.
I can turn the all attached event handlers off perfectly by using:
$('.eventone').off();
or as a multiple selector:
$('.eventone, .eventtwo, .eventthree').off();
However, I'm not getting all (or even any) event handlers to turn back on.
I'm using this:
$('.eventone, .eventtwo, .eventthree').on();
Is there something I'm doing wrong?
Do I actually have to declare every event that's associated with the class
in order to turn it back on?

No comments:

Post a Comment