0

In the world of dynamically updated page fragments via Ajax (often lacking the use of best practices!), I encounter the attachment of event listeners scattered all over an application's JS. Sometimes, the developer would have adhered to some practical conventions that make it somewhat easy to track down code that attaches specific event listeners to DOM elements. Not always.

In this sad scenario, what is the best way to enumerate/view event listeners attached to a particular node/element? I enjoy using Chrome's amazing developer tools, although this is one area where the tool does not give me a whole lot of information.

Can I employ JavaScript or jQuery code to:

  1. view a list of event listeners
  2. track the code that sets up an event listener

Note: I originally asked about a way to examine event listeners in Chrome Dev Tools, but if there is a way to do it in code, I actually prefer that!

Edit: This answer is what I was looking for!

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Web User
  • 7,438
  • 14
  • 64
  • 92
  • "Questions asking us to _recommend or find a book, tool, software library, tutorial or other off-site resource_ are off-topic for Stack Overflow as they tend to attract opinionated answers and spam." – Evan Davis Oct 31 '14 at 15:54
  • Hi @Mathletics I modified my question. Thanks. – Web User Oct 31 '14 at 19:45

0 Answers0