我试图从输入中捕获按键,然后聚焦一个元素。Firefox 17焦点选择框不工作
<input id="asdfasfd1" />
<input id="asdfasfd2" />
<select id="currency"><option>bla</option></select>
$(function() {
var currencyElement = $('#currency');
$('#asdfasfd1').bind('keypress', function(event) {
event.preventDefault();
currencyElement.focus();
});
});
http://jsfiddle.net/KkXwT/6/在IE 8,9,10和Chrome 23,但不能在Firefox 17,做了一些知道为什么它不工作?
看看这个http://stackoverflow.com/questions/2562723/javascript-focus-and-select-not-working-in-ff或这个http://www.weberforums.com/topic11544.html – Behnil
你提供的jsfiddle对我来说完美无缺。当我在第一个文本框中按下任何键时,组合将获得焦点。我有一个Mac上的Firefox 17.0.1。 – 2012-12-13 08:55:19
behnil这是一个选择框不是输入框,它不工作在Firefox 17上运行的Windows 8 – daanl