當我的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