【问题标题】:Cannot set focus on a textbox in IE8无法在 IE8 中的文本框上设置焦点
【发布时间】:2012-10-05 18:40:13
【问题描述】:

IE8 似乎是我最近存在的祸根。我试图在我的应用程序中创建新步骤时设置焦点。这是我的代码:

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

这适用于我测试过的所有其他浏览器(Firefox、Chrome、Safari)。它甚至适用于 IE9,但不适用于 IE8。任何帮助将不胜感激。谢谢。

【问题讨论】:

  • stepField ?那是一个插件吗?它在 IE8 中返回什么?
  • 是的,你能告诉我们stepField在做什么吗?没有 stepField 可以吗?
  • stepField 只是一个返回步骤名称的函数:stepField: function(name) { return this.step().find(':input[name="step[' + name + ']"]'); },

标签: javascript jquery internet-explorer-8


【解决方案1】:

在 ie8 中工作:

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

来源:jQuery focus() sometimes not working in IE8

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

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-09-11
  • 1970-01-01
  • 1970-01-01
  • 2010-11-23
  • 1970-01-01
  • 2016-05-23
  • 1970-01-01
相关资源
最近更新 更多