简体   繁体   English

当我单击HTML对象时,如何知道哪个事件触发?

[英]How can I tell which event fires when I click on an HTML object?

I'm trying to download and re-use the phone simulator here , and I want to find the javascript that allows me to switch devices in the "OS Simulator mode". 我正在尝试在此处下载并重新使用电话模拟器 ,并且我想找到允许我在“ OS Simulator模式”下切换设备的JavaScript。

Right now I have a local instance working, but the page isn't refreshing as it should be. 现在我有一个本地实例在工作,但是页面没有刷新。 I tried the Javascript console in chrome but I don't see any events " fly by " as I click on the object and wait for something to happen in the F12 window. 我在chrome中尝试了Javascript控制台,但是当我单击对象并等待F12窗口中发生的事情时,没有看到任何“飞过”的事件。

How do I get the event name for the Javascript that should be firing? 如何获取应该触发的Javascript的事件名称?

Add the below code snippet:- 添加以下代码段:-

function eventLogger(e) {
    console.log(e);
}

$(document).bind("click keydown keyup mousemove", eventLogger);

you can add/update the bind events to get log on additional events you want to capture. 您可以添加/更新绑定事件,以获取要捕获的其他事件的日志。

Check this: 检查一下:

$("*").click(function(){

       alert($(this).prop("tagName"));

});

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

相关问题 在firebug中查看页面时,我可以看到单击按钮时会触发哪个事件? - when viewing a page in firebug, can I see which event fires when I click a button? 每当点击事件触发时,如何将变量加一 - How can I add a variable by one whenever a click event fires 在backbone.js中收听集合的change事件时,如何判断哪个模型发生了变化 - How can I tell which model changed when listening to the change event of a collection in backbone.js 当我单击页面时,“ beforeunload”事件仅在firefox中触发 - 'beforeunload' event only fires in firefox when I click on the page 单击事件触发后,我才能按下按钮进行确认 - click event fires before i can press button to confirm 如何使用jQuery确定是否在特定元素中触发click事件? - How can I use jQuery to determine if a click event fires within a specific element? 我如何知道对 jquery html() 的更改何时完成? - How can I tell when changes to jquery html() have finished? 我如何知道Click事件上正在加载哪个脚本文件 - How can i know which script file is loading on Click event 我怎么知道哪个元素激活了javascript中的点击事件? - How can i know which element activated a click event in javascript? 从输入中删除字符时,如何防止keyup事件触发两次? - How can I prevent the keyup event fires twice when remove a character from input?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM