jQuery find events handlers registered with an object

dom, events, jquery

Solution

As of jQuery 1.8, the event data is no longer available from the "public API" for data. Read this jQuery blog post. You should now use this instead:

jQuery._data( elem, "events" );

`elem` should be an HTML Element, not a jQuery object, or selector.

Please note, that this is an internal, 'private' structure, and shouldn't be modified. Use this for debugging purposes only.

In older versions of jQuery, you might have to use the old method which is:

jQuery( elem ).data( "events" );

Problem

I need to find which event handlers are registered over an object. For example: ``` $("#el").click(function() {...}); $("#el").mouseover(function() {...}); ``` `$("#el")` has click and mouseover registered. Is there a function to find out that, and possibly iterate over the event handlers? If it is not possible on a jQuery object through proper methods, is it possible on a plain DOM object?

Original source