0

Is there a way to retrieve all event listeners attach to an element of the DOM using Jquery?

For example, if I had the following JS code

$("#div1").click(foo)

is there any way to retreieve the event-onclick from #div?

  • Does this answer your question? [How to find event listeners on a DOM node when debugging or from the JavaScript code?](https://stackoverflow.com/questions/446892/how-to-find-event-listeners-on-a-dom-node-when-debugging-or-from-the-javascript) – Terry Jan 14 '21 at 22:52
  • 1
    You can use `jQuery._data(element, "events");` to fetch the events attached to an element. Read more [in this answer](https://stackoverflow.com/a/2518441/14956277) and note that this should be treated as read-only and only used for debugging. – D M Jan 14 '21 at 22:52

0 Answers0