[英]Chrome Developer Tools : How to know the event triggered when click a element?
When i'm in any website, how can i use Chrome Developer Tools to find out what JS function is called when i click on an element ? 当我在任何网站时,我如何使用Chrome开发者工具找出点击元素时调用的JS函数?
For instance, i'm on a website that has a DIV element. 例如,我在一个有DIV元素的网站上。 When i click on this DIV, it will do some actions.
当我点击这个DIV时,它会做一些动作。 I want to know what JS function do these actions, so i am able to call this JS function programatically in the console, without need to manually click on the DIV.
我想知道JS函数执行这些操作是什么,所以我能够在控制台中以编程方式调用此JS函数,而无需手动单击DIV。
Thanks ! 谢谢 !
All the event listeners for an element are shown in the Event Listeners panel. 元素的所有事件侦听器都显示在“事件侦听器”面板中。 If you expand the 'click' event section you'll see what scripts are at play.
如果展开“点击”事件部分,您将看到正在播放的脚本。
Once you've found a likely script, expand its object to see function names (except, of course, for anonymous functions) and other properties. 找到可能的脚本后,展开其对象以查看函数名称(当然,除了匿名函数)和其他属性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.