0

I am in such a situation that need to view which events are added to some DOM element?

If we addEventListener where it is stored? Is there any way to view them? And last one, Is there any way to remove all bonded event from element, I do not mean individually?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Taron Mehrabyan
  • 2,199
  • 2
  • 20
  • 27
  • exact duplicate of [How to find event listeners on a DOM node?](http://stackoverflow.com/questions/446892/how-to-find-event-listeners-on-a-dom-node) – Bergi Feb 27 '14 at 21:49

2 Answers2

0

As far as I know, there is no way to see the listeners you registered.

You have to remove all of them one by one, to avoid memory leaks.

A good way to solve your problem is to use a library like js-signal to handle your listeners, instead of native JS event listeners. Amongst many other advantages, it will allow you to remove all events in an unique operation.

Pascal Le Merrer
  • 5,883
  • 20
  • 35
0

As @Pascal_Le_Merrer has said there is no way to do this in code, but with Chrome DevTools you can see the EventListeners attached to dom nodes from within the elements tab. More information can be found near the bottom of this page: https://developers.google.com/chrome-developer-tools/docs/elements

HJ05
  • 1,358
  • 2
  • 11
  • 23