当我的PHP页面加载一些jQuery的应该将焦点设置到我的输入文本框,但它不会.focus()事件不工作
我试图像input[tabindex=1]
和#31
但无济于事CSS选择器...
这里是jQuery的(1.7.1版本)
$(function() {
$('input[tabindex=1]').focus(); // also tried $('#31').focus();
});
这里是HTML
<input tabindex='1' type='text' class='tablefilter' id='31' style='width:80px;border:inset 2px grey;background-color:white;font-size:12px;border-radius:0px;-moz-border-radius:0px;-webkit-border-radius:0px;'/>
任何线索为什么这不起作用?
什么浏览器?有时在'setTimeout()'(使用非常短的计时器)中进行焦点帮助。 – Pointy 2012-07-05 15:33:36
适合我; http://jsfiddle.net/DUxkH/ – Matt 2012-07-05 15:34:40
使用IE9让我用ff和chrome进行测试,我也安装了那些 – ScottC 2012-07-05 15:42:53