In jQuery v1.7 a new method, on was added. From the documentation:
‘The .on() method attaches event handlers to the currently se
Something you should be aware of if you want to get the event handlers associated with the element - pay attention which element the handler was attached to!
For example, if you use:
$('.mySelector').bind('click', fn);
you will get the event handlers using:
$('.mySelector').data('events');
But if you use:
$('body').on('click', '.mySelector', fn);
you will get the event handlers using:
$('body').data('events');
(in the last case the relevant event object will have selector=".mySelector")