简体   繁体   English

如何找出HTML元素附加的事件?

[英]How can I find out what events are attached to HTML elements?

I would like to understand more about jQuery and I'm finding one thing I would like to do is to be able to find out what events are attached to elements. 我想更多地了解jQuery,我发现我想要做的一件事就是能够找出哪些事件附加到元素上。 Is there some way using the debugger in IE or Firebug that I can find this out. 有没有办法在IE或Firebug中使用调试器,我可以找到它。 I don't mean by looking at the source code. 我不是说通过查看源代码。 What I would like to do is to see events in the same way as I can check out CSS properties with firebug. 我想做的是以与使用firebug检查CSS属性相同的方式查看事件。

Try FireQuery for FireFox 尝试FireQ for FireFox

http://firequery.binaryage.com/ http://firequery.binaryage.com/

When you inspect the elements in FireBug, it shows you all of the events attached to the element. 检查FireBug中的元素时,它会显示附加到元素的所有事件。

simply execute jQuery('#elem_id').data('events'); 只需执行jQuery('#elem_id').data('events'); in the firebug console , it will list all the events bound to the elements . firebug console ,它将列出boundelements所有events

You can see it with Opera Dragonfly too, just inspect the element and go to properties tab on the inspect sidebar: 您也可以使用Opera Dragonfly查看它,只需检查元素并转到检查侧栏上的属性选项卡:

蜻蜓截图

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM