简体   繁体   English

JQuery 是:焦点在 IE8 中不起作用

[英]JQuery is:focus not working in IE8

I check for focus on a text field with this:我用这个检查文本字段的焦点:

if ($('#title').is(":focus"))

<input type="text" id="title" value="Write your post..." />

every other browser determines this as true, IE8 does not.每个其他浏览器都将其确定为 true,而 IE8 则不会。 Does this work in IE8?这在IE8中有效吗?

This should work no matter what mode IE is running in:无论 IE 在什么模式下运行,这都应该有效:

if(document.getElementById('title')==document.activeElement)

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM