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