admin管理员组文章数量:1414908
The following code behaves different when tab and enter keys are pressed:
--tab replaces the text field's value with the value of the selected item and focus goes to the next input box
--enter replaces the text field's value with the value of the selected item but the focus does not go to the next input box
How do I change the behavior of enter so that the focus goes to the next input box?
$('input').autoplete({
autoFocus: true,
source: ["test","some text"],
delay: 0
});
I have tried to add the following line:
select: function(event, ui) { if (event.keyCode == 13) { trigger({ type : 'keypress', which : 9 }); } }
This doesn't work. See /
The following code behaves different when tab and enter keys are pressed:
--tab replaces the text field's value with the value of the selected item and focus goes to the next input box
--enter replaces the text field's value with the value of the selected item but the focus does not go to the next input box
How do I change the behavior of enter so that the focus goes to the next input box?
$('input').autoplete({
autoFocus: true,
source: ["test","some text"],
delay: 0
});
I have tried to add the following line:
select: function(event, ui) { if (event.keyCode == 13) { trigger({ type : 'keypress', which : 9 }); } }
This doesn't work. See http://jsfiddle/YbPVX/4/
Share Improve this question asked Jul 31, 2011 at 22:31 RandomblueRandomblue 116k150 gold badges363 silver badges558 bronze badges1 Answer
Reset to default 6Try this
$('input').autoplete({
autoFocus: true,
source: ["test","some text"],
delay: 0,
select: function(event, ui) { if (event.keyCode == 13) {
$(this).next("input").focus().select();
} }
});
-> http://jsfiddle/YbPVX/5/
本文标签: javascriptjQuery autocomplete want Return key to behave as TabStack Overflow
版权声明:本文标题:javascript - jQuery autocomplete; want Return key to behave as Tab - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745171251a2645987.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论