[英]How can I tell what events are bound to a DOM element?
When using the Wordpress visual editor, if you have a [gallery]
shortcode, in visual mode it is presented with a placeholder. 使用Wordpress可视化编辑器时,如果您有
[gallery]
短代码,则在可视模式下会显示一个占位符。
Clicking the placeholder will overlay two icons - edit gallery and remove gallery. 单击占位符将覆盖两个图标 - 编辑库和删除库。
I'm trying to figure out what function fires when 'edit gallery' is clicked. 我正在试图找出点击“编辑图库”时触发的功能。
The button is an image, with the dom id wp_editgallery
, and this is how it looks: 该按钮是一个图像,dom id为
wp_editgallery
,它的外观如下:
My instincts are to inspect the element using Chrome's web inspector: 我的直觉是使用Chrome的网络检查器检查元素:
After finding the element, I check out the properties panel and look for events, but the results are somewhat cryptic: 找到元素后,我查看属性面板并查找事件,但结果有点神秘:
So far I've tried the above method, and also: 到目前为止,我已经尝试了上述方法,并且还:
var events = jQuery._data('#wp_editgallery', 'events');
As was recommended in How to see what exact events are bound to DOM elements? 正如在如何查看绑定到DOM元素的确切事件中所建议的那样? I also tried using
Visual Event
as was mentioned in that post - both without success. 我也试过使用
Visual Event
文章中提到的Visual Event
- 两者都没有成功。
Is there an easier way of find out what javascript function is tied to an DOM element's event listener? 有没有更简单的方法来找出javascript函数绑定到DOM元素的事件监听器?
check out Visual Event . 看看视觉事件 。 Works awesome with Chrome!
与Chrome一起工作真棒! Lets you view and run the events attached to DOM elements.
允许您查看和运行附加到DOM元素的事件。 Has been a life saver!
一直是救命的人!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.