Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript debugging: How to set breakpoint on the actrual event handler code?

Is there any way to let Chrome Debugger break when run into different Javascript file?

Because I'm debugging an legacy web app, tons of js file, this feature will help me to find the event handler binded with jquery.click() method.


modified: Or simply, how to quickly find the actural event handler code for jquery?

like image 417
Colin Niu Avatar asked Jan 16 '26 20:01

Colin Niu


1 Answers

You could put a breakpoint in the jQuery code and only make it break when the event is a click method.

If jQuery minified, there's a boring way: in Chrome DevTools, right panel of the "Source" tab, there's "Event Listener Breakpoints", check the event you want to debug, then go back to page, trigger that break point, step in, step out, step in, step out.

Source: Answer is based on the comments.

like image 178
kenorb Avatar answered Jan 19 '26 20:01

kenorb



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!