Reputation: 9890
I need to fix code on menu mouse over event in a site that contain a numerous of JavaScript files.
Now my Problem is how to find required JavaScript file in such a huge site which contain that mouse over event code. I want the file where that mouse over event is coded. Hope you understand.
Upvotes: 1
Views: 102
Reputation: 17899
Open the Developer Tools in Chrome, open the scripts panel, then press F8 and put your mouse over the element you are interested in.
The mouseover
event will fire, but will be paused as if there was a debugger
statement in the event handler.
Then step over the functions (over all jQuery functions, yes) until you hit the place where the event is attached to the element.
Another variant is to grep -rl
or ack
(my favorite) for mouseover
or the ID of the element in the directory where your JavaScript files are located.
grep -rl 'mouseover' js/
Upvotes: 0
Reputation: 8198
In Google Chrome's "Inspect Element" tool, if you scroll to the very bottom of the right pane (beneath all the CSS) you will find "Event Listeners".
Using this, you can find out where exactly the event listener code is for any element that the event listener is attached to.
I am not sure if Firebug has this same feature, I couldn't find it myself.
Upvotes: 2