If you need to find a way to get the list off all the events bound on an element here is a code that you can use.
My example cover event delegation just to show how these events are displayed in the console.
.
jQuery("myelemnt").on({ click: function(){ console.log("click") }, mouseout: function(){ console.log("mouseout") } }); //test event delegation jQuery("myelemnt").on("click","a", function(){ console.log("a click"); }); jQuery("myelemnt").on("mouseout","a", function(){ console.log("a mouseout"); }); //for jQuery 1.8 + var $events = jQuery._data(jQuery("myelemnt")[0], "events" ); //for jQuery 1.7 and below //var $events = jQuery('myelemnt').data('events'); //validate if the element has an event attached if(typeof $events != "undefined"){ //iteration to get each one of the handlers jQuery.each($events, function(i, event){ jQuery.each(event, function(i, handler){ console.log(handler); // write on console the handler }); }); }
Output example:
Useful links:
- http://stackoverflow.com/questions/1236067/test-if-event-handler-is-bound-to-an-element-in-jquery
- http://stackoverflow.com/questions/2008592/can-i-find-events-bound-on-an-element-with-jquery
I really hope you find this information useful.