简体   繁体   English

Chrome开发者工具:如何知道点击元素时触发的事件?

[英]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.

相关问题 如何知道在悬停jQuery中触发事件的元素? - How to know the element that triggered the event in hover jquery? 如何在 chrome 开发者工具中自动化需要点击 javascript 按钮的代码 - How to automate the code that requires the click of a button in javascript in chrome developer tools 我如何在JS触发的routeChangeStart事件事件中了解或单击 - How i will get to know in routeChangeStart event event triggered by JS or click 如何关闭Google Chrome开发人员工具中的fancybox元素? - How to close a fancybox element in Google Chrome developer tools? 为什么在chrome覆盖节点时未触发click事件 - Why is the click event not triggered when the node covered in chrome 如何知道从哪个 DOM 单击事件被触发 - How to know from which DOM click event is triggered Chrome 开发者工具 - 动态创建的元素 - Chrome Developer Tools - Dynamically Created Element 触发其他元素的模糊事件时无法触发按钮单击事件 - Button click event can not be triggered when it triggered blur event for other element Chrome开发人员工具(如何知道我正在调用哪个javascript对象) - Chrome developer tools (How to know I am calling which javascript object) 打开chrome开发人员工具时的双重请求 - Double request when chrome developer tools open
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM