Tuesday, August 2, 2011

jQuery events

Ever curious to know what events are bound to DOM elements?   You can access DOM elements by its DOM data storage element:

// List bound events:
console.dir( jQuery('#elem').data('events') );
// Log ALL handlers for ALL events:
jQuery.each($('#elem').data('events'), function(i, event){
    jQuery.each(event, function(i, handler){
        console.log( handler.toString() );
// You can see the actual functions which will occur
// on certain events; great for debugging!

No comments:

Post a Comment