is it possible to extend normal events for plugins in a general way?
e.g.
say i have a plugin A which does stuff and react to the click event on an element
i would now to perform some actions when that element is clicked, and AFTER i have done my stuff i want the plugin to do whatever it does onlick.
at the moment i am manually looking at the plugin and create custom code, but maybe there is some general way that one can prevent a click event for a plugin temporarily, and then trigger it?
You can bind multiple event handlers to a single event, so, for example, you could do something like this:
This would be executed as well as the existing code when the
clickevent is triggered. However, there’s nothing to say it will run before the existing code.Unfortunately, jQuery does not provide a method for sorting the events, so I think your best bet will probably be to simply modify the
clickevent handler in the plugin to call your function first.