Monday, May 20, 2024
-1
rated 0 times [  1] [ 2]  / answers: 1 / hits: 120905  / 13 Years ago, wed, september 7, 2011, 12:00:00

Lets suppose I've a link on my page:



<a href=# id=foo>Click Here</a>


I don't know anything else, but when I click on the link, an alert(bar) is displayed.
So I know that somewhere, some code is getting bound to #foo.



How can I find the code that is binding the alert(bar) to the click event?
I'm looking for a solution with Chrome.



Ps.: The example is fictive, so I'm not looking for solution like: Use XXXXXX and search the whole project for alert(bar). I want a real debugging/tracing solution.


More From » google-chrome

 Answers
84

Using Chrome 15.0.865.0 dev. There's an Event Listeners section on the Elements panel:



enter



And an Event Listeners Breakpoints on the Scripts panel. Use a Mouse -> click breakpoint and then step into next function call while keeping an eye on the call stack to see what userland function handles the event. Ideally, you'd replace the minified version of jQuery with an unminified one so that you don't have to step in all the time, and use step over when possible.



enter


[#90218] Tuesday, September 6, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
brandon

Total Points: 393
Total Questions: 106
Total Answers: 106

Location: Aland Islands
Member since Wed, Nov 17, 2021
3 Years ago
;