javascript - How can I find what onChange function an Element has? - Stack Overflow

I have a page which loads a lot of JavaScript files. Somewhere in the files, an onchange handler is add

I have a page which loads a lot of JavaScript files. Somewhere in the files, an onchange handler is added to an inputfield A.

When a value is added into inputfield A, inputfield B is automatically filled in with another value (depending on the value of A).

The sheer number of files and the names of the inputfields ('code', 'key') make it hard to use grep to find where the onchange is defined.

I've tried using

  • Opera Dragonfly
  • Firefox Firebug
  • Google Chrome Developer Tools

but I can't seem to find out how to get them to show me where I can find the onchange function that gets called.

Anyone got an idea?

I have a page which loads a lot of JavaScript files. Somewhere in the files, an onchange handler is added to an inputfield A.

When a value is added into inputfield A, inputfield B is automatically filled in with another value (depending on the value of A).

The sheer number of files and the names of the inputfields ('code', 'key') make it hard to use grep to find where the onchange is defined.

I've tried using

  • Opera Dragonfly
  • Firefox Firebug
  • Google Chrome Developer Tools

but I can't seem to find out how to get them to show me where I can find the onchange function that gets called.

Anyone got an idea?

Share Improve this question asked May 18, 2011 at 13:06 KonerakKonerak 39.8k12 gold badges101 silver badges121 bronze badges 2
  • 1 Do you know that something is assigning to the 'onchange' property: it may be using addEventListener or equivalent (which is a much more flexible interface for setting event handlers, but bypasses the "onxxx" properties) – Colin Fine Commented May 18, 2011 at 13:17
  • That is possible too - can you include how to find these too in your answer? :) – Konerak Commented May 18, 2011 at 13:43
Add a ment  | 

5 Answers 5

Reset to default 1

you can see the jquery expression in firebug DOM inspector using firequery in firefox https://addons.mozilla/en-us/firefox/addon/firequery/

Chrome has build in developer tools that allow you to inspect an element and see any event listeners attached to it.

Google chrome developer tools really are amazing. http://code.google./chrome/devtools/docs/elements.html

You can use Firebug to set a breakpoint when a particular HTML element has an attribute change:

http://getfirebug./doc/breakpoints/demo.html#html

You could try selecting the second element you've described (that gets filled in) and see if that works for you.

Visual Events allows you to inspect the bound events without editing your code:

http://www.sprymedia.co.uk/article/Visual+Event

I had the same issue and I used Google Chrome's dev tool and it helped. Follow the steps below:

  1. Select the event listener breakpoint

  2. Select control checkbox

  3. Select onChange this will pause on the onChange function in your code

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744846843a4596890.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信