简体   繁体   English

如何找出点击事件被捕获的位置?

[英]How can I find out where a click event gets caught?

I am working on a very complex website and i have a piece of HTML on the page inside which no button is clickable. 我正在一个非常复杂的网站上工作,我在页面上有一段HTML,里面没有按钮可点击。 I think the click event gets caught somewhere so that the click handlers of the buttons do not fire. 我认为click事件会被捕获到某处,以便按钮的点击处理程序不会触发。

How can I find out where those click events gets caught? 如何找出这些点击事件被捕获的位置?

Add a click event listener to the document, and see what's catching the event: 向文档添加单击事件侦听器,并查看捕获事件的内容:

document.addEventListener('click',function(e){
    console.log(e.target);
})

只需检查click事件的event.target即可查看它的位置。

在页面中包含的javascript中应该有一个document.click()document.live("click",...)处理程序,它返回false

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

相关问题 如何找出Bootstrap药丸的click事件? - How can I find out the click event for Bootstrap Pills? 从窗口中的任何位置单击选择框时,如何获得选择框关闭事件? - How can i get Select box close event when click out of the select box any where in window? 在对象上触发了dispatchEvent,我如何找出如何侦听该对象以及该事件在何处调度? - Having a dispatchEvent triggered on an object how can I find out how to listen to it and where the event is dispatched? 我怎样才能找到哪个字符在退格时的tinymce编辑器中被删除(在它实际被删除之前)? - How can i find out which character gets deleted in a tinymce editor on backspace (before it actually gets deleted)? 如何在网址与链接匹配的情况下触发点击事件 - How can i trigger click event where URL matching the link 我如何找出脚本两次加载的位置? - How can I find out where a script is loading twice? 我如何找到在哪里发起javascript事件? - How can I find where a javascript event is initiated? 如何调试为什么单击事件从按钮中删除? - How can I debug why the click event gets removed from a button? 我的点击事件功能在某些情况下停止工作,我无法找到此代码失败的位置 - My click event function stop working for some cases and I can't find where do this code fails 找出javascript对象的创建位置 - Find out where a javascript object gets created
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM