GetEventListeners

Returns all the event listeners and mutation observers registered for a specific target. The target can either be an element or another DOM object that accepts event listeners (e.g. window<code> or an <code>XMLHttpRequest).

The Console panel result is a simple object containing an array for each event type (e.g. "click" or "mousemove"). The following screenshot shows that there are two click and one mousemove listeners registered on the <body> element.

If you want to see more about registered listeners, click the green object in the Console Panel and you'll be navigated to the DOM Panel. See the next screenshot.

Every item in the arrays describes a particular listener. You can see whether useCapture is set and the name of the function used as the listener handler. If you click the function, you'll be navigated to the Script Panel to see its source code.

JavaScript libraries that provide the ability to add event listeners often register their own functions as listeners, to make sure they can handle e.g. return values correctly. For instance, in the following example with prototype.js, f is a Prototype-internal function: