Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
448 views
in Technique[技术] by (71.8m points)

javascript - 在调试时或从JavaScript代码中如何在DOM节点上查找事件侦听器?(How to find event listeners on a DOM node when debugging or from the JavaScript code?)

I have a page where some event listeners are attached to input boxes and select boxes.

(我有一个页面,其中一些事件侦听器附加到输入框和选择框。)

Is there a way to find out which event listeners are observing a particular DOM node and for what event?

(有没有一种方法可以找出哪些事件侦听器正在观察特定的DOM节点以及针对哪个事件?)

Events are attached using:

(使用以下事件附加事件:)

  1. Prototype's Event.observe ;

    (原型的 Event.observe ;)

  2. DOM's addEventListener ;

    (DOM的addEventListener ;)

  3. As element attribute element.onclick .

    (作为元素属性element.onclick 。)

  ask by Navneet translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If you just need to inspect what's happening on a page, you might try the Visual Event bookmarklet.

(如果只需要检查页面上发生的事情,则可以尝试使用Visual Event书签。)

Update : Visual Event 2 available;

(更新视觉事件2可用;)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...