简体   繁体   English

无法将焦点设置在IE8中的文本框中

[英]Cannot set focus on a textbox in IE8

IE8 seems to be the bane of my existence lately. IE8似乎是最近我生存的祸根。 I am trying to set focus when a new step is created in my application. 当我在应用程序中创建新步骤时,我试图设置焦点。 Here is my code: 这是我的代码:

$(this).stepField('action_description').focus();

This works in all other browsers I've tested with (Firefox, Chrome, Safari). 这在我测试过的所有其他浏览器(Firefox,Chrome,Safari)中都可以使用。 It even works in IE9, but not IE8. 它甚至适用于IE9,但不适用于IE8。 Any help would be vastly appreciated. 任何帮助将不胜感激。 Thanks. 谢谢。

To work in ie8 : 要在ie8中工作:

    setTimeout(function() {
        $('#myElement').focus();
    }, 10);

SO source: jQuery focus() sometimes not working in IE8 SO源: jQuery focus()有时在IE8中不起作用

Issue documented by MS : http://support.microsoft.com/kb/979954 MS记录的问题: http : //support.microsoft.com/kb/979954

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

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