This question already has an answer here:
Is there a way to check if an event exists in jQuery? I’m working on a plugin that uses custom namespaced events, and would like to be able to check if the event is binded to an element or not.
This question already has an answer here:
Is there a way to check if an event exists in jQuery? I’m working on a plugin that uses custom namespaced events, and would like to be able to check if the event is binded to an element or not.
use jquery event filter
you can use it like this
I wrote a plugin called hasEventListener which exactly does that.
Hope this helps.
I have answered to similar question here: hasHandlers() helper
Work with jQuery >= v1.11.0
You can inspect by feeding the object reference ( not the jQuery object though ) to $.data, and for the second argument feed 'events' and that will return an object populated with all the events such as 'click'. You can loop through that object and see what the event handler does.
This work for me it is showing the objects and type of event which has occurred.
To check for events on an element:
For example:
or
Full Example:
A more complete way to check, that includes dynamic listeners, installed with $(document).on
Example usage: