I’m developing some javascript widget which loaded on many other sites.
When widget are loading I bind jquery live event on links and buttons.
For instance:
$('.my-submit').live('click', function() {...});
...
$('.my-link').live('click', function() {...});
So the question is how can I remove all live events only for widget links and buttons?
The simple way to do this is to bind with a namespace, and remove all the namespaced events:
You can then call
diewith the namespace:Better yet is to use the
onandofffunctionality introduced in jQuery 1.7. This is a far superior way to handle binding and unbinding events: