I have a page which is using a nice hover feature which is controlled by javascript, and I was wondering if there is a tool which would tell me what JS is controlling at a specific point as there is a lot of JS files used across the site.
-
4F12 on chrome , good luck. – mpm Jan 18 '13 at 16:36
-
Any mordern browser's developer tools can help you do this (For instance [chrome's developer tools](https://developers.google.com/chrome-developer-tools/)). Typically launched using `F12` in most browsers. – Nivas Jan 18 '13 at 16:39
-
Try this bookmarklet: http://www.sprymedia.co.uk/article/Visual+Event+2 – gen_Eric Jan 18 '13 at 16:39
-
possible duplicate of [How do I find out what javascript runs when I click an element?](http://stackoverflow.com/questions/10262902/how-do-i-find-out-what-javascript-runs-when-i-click-an-element) – bfavaretto Jan 18 '13 at 16:39
4 Answers
In google chrome right-click the element, click on "Inspect Element" option. The Chrome Developer window with active Elements tab should appear. You'll see the html structure with your element being highlighted. Right-click on that element and activate all three options in "Break on..." submenu. If some modifications of DOM happen during hover, they will trigger the breakpoint right in the place where you need. But keep in mind, that hover effects can be implemented via css without a bit of javascript, so this plan can fail easily.
As other's have said, use Chrome's web developer toolbar. Go to the sources panel and click the little pause button icon in the lower left corner. This will cause the debugger to activate as soon as the next javascript command is run. Then activate the hover feature - the debugger should pause execution in the callback function that's responsible.
Google actually discusses this exact scenario at the bottom of this documentation page.

- 37,461
- 11
- 73
- 73