How to check bound events in jQuery.

There are so many variations of finding bound events to elements in jQuery and a lot of them just work in old versions. To be honest I can’t remember this┬áline cause it looks ridiculous. I don’t understand why it is so complicated and even changes from old versions.

In stackoverflow I found that

“In jQuery 1.8, it is no longer possible to access the element’s events using .data(‘events’). (See this bug for details.) It is possible to access the same data with jQuery._data(elem, ‘events’), an internal data structure, which is undocumented and therefore not 100% guaranteed to remain stable. This shouldn’t, however, be a problem, and the relevant line of the plugin code above can be changed to the following:”

var data = jQuery._data(this[0], 'events')[type];

In my projects I’m using the following line

$._data($('.field.styled.checkbox')[0],"events");
Share this post:Tweet about this on TwitterShare on Facebook0Share on LinkedIn0Share on Google+0Share on Reddit0Email this to someoneDigg this