1

I'm working on a webpage which uses sources I'm not familiar with. One of the elements is having its position changed on mouse hover, but I can't find any corresponding CSS that is triggering that behavior. Thus, it is probably JavaScript. How can I find the culprit without figuring every possible selector for this element and then going through every possible JavaScript file to attempt and find where it is being used?

  • 1
    http://stackoverflow.com/questions/2008592/can-i-find-events-bound-on-an-element-with-jquery – epascarello Nov 03 '14 at 18:46
  • 1
    http://stackoverflow.com/questions/11065358/find-attached-bound-events-of-an-element-using-chrome-development-tools-fire – epascarello Nov 03 '14 at 18:46
  • You can find some key things to grep for in the sources in order to find where the code is that might be hooking up a relevant event handler. If the code is all jQuery, then you can grep for `.hover(` and `.mouseenter(` to see if any of those hits look like they are relevant to your object. Many times, the target object will have an obvious selector (like an id) and you can grep for any event handlers for the obvious selector. There is no formula. Based on the HTML, the coding style and the libraries used, you have to figure out what to look for in the code. – jfriend00 Nov 03 '14 at 18:49

1 Answers1

0

You can use chrome dev tools to figure out it. In the elements tab select the item you want to inspect and in the right side the is another tab called "Event Listeners". There you can see what events are attached to an element and the script file which is calling it.

ianaya89
  • 4,153
  • 3
  • 26
  • 34
  • 3
    If it's jQuery, this won't help much because ALL the actual event listeners will just point to jQuery internals. – jfriend00 Nov 03 '14 at 18:52