[英]How can I figure out where Javascript is changing my focus
I am currently working on an ASP.Net project that has a large number of js files, most from third party sources. 我目前正在一个ASP.Net项目中,该项目具有大量的js文件,大部分来自第三方。 On a number of pages, the focus is being set to a control other than the one I'm setting it to in code-behind (Control.Focus()).
在许多页面上,焦点都设置为控件,而不是我在代码隐藏(Control.Focus())中将其设置为的控件。 How can I figure out how, why, and where the focus is being changed?
我如何弄清楚焦点的改变方式,原因和位置?
I have installed FireFocus for FireBug so I can see the focus being changed, but I cannot see the cause. 我已经为FireBug安装了FireFocus ,因此可以看到焦点已更改,但看不到原因。
Using the link provided by Moby's Stunt Double, I added the following code to the bottom of my page and every time the focus was changed, the call stack was dumped to my console so I could trace the source. 使用Moby的Stunt Double提供的链接,我在页面底部添加了以下代码,每次更改焦点时,调用堆栈都被转储到控制台中,以便我可以跟踪源。
<script type="text/javascript">
$("#TabInformation").on("focus", function (event) {
try { throw new Error("dummy"); } catch (e) { console.log(e.stack); }
});
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.