It might be worth mentioning that Firebug 1.12 introduced getEventListeners(target) . The Firebug Wiki page for this is here , and there is a very useful blog post about it here .
(Firebug 1.12 was only released in August 2013, so the answer to this question was right when it was originally published.)
However, there are a few caveats for getEventListeners :
First of all, this will not work if you pass it a jQuery object; pass it a regular DOM object. (Perhaps this is obvious, but it caught me!)
Secondly, I found that getEventListeners does not always work if I ran it before all the code on the page loaded. I am not sure exactly when this happens and does not work, but of course I saw this situation:
>>> getEventListeners(document.getElementById('elementid')) ReferenceError: getEventListeners is not defined >>> $._data(document.getElementById('elementid'), "events"); Object { click=[1]}
As you can see, the longhand method (from the SO message associated with the response) may receive the event, but getEventListeners displayed as undefined. This error is different from the return value if getEventListeners works, but reports that the object has no listeners, so I would say that you can use getEventListeners without fear, as this will be obvious if it is not already available!
Sam
source share