jQuery UI的自动完成DownArrow中文UPARROW [英] jQuery UI Autocomplete DownArrow UpArrow
本文介绍了jQuery UI的自动完成DownArrow中文UPARROW的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有jQuery的自动完成一些问题和移动箭头和UPARROW?
I am having some issues with jQuery Autocomplete and moving DownArrow and UpArrow ?
这个问题似乎是:
<输入ID =自动完成输入VALUE =>
focus: function (event, ui) {
$('#autocomplete-input').val(ui.item.label);
}
这伟大工程鼠标焦点 - 但是当我使用 arrowUp
和 arrowDown
- 它选择了 ui.item.id
之上的 ui.item.label
This works great for MOUSE focus - but when I use arrowUp
and arrowDown
- it selects the ui.item.id
over and above the ui.item.label
我怎样才能解决这个问题,这样可以:
How can I fix this so that either:
- 在
输入
VAL完全不[即改它使用户
输入的词] - 它更新
输入
VAL与关注
VAL用户与KEYDOWN / KEYUP
- the
input
val isn't changed at all [i.e. it keeps the users inputted term] - it updates the
input
val with thefocused
val the user is on with keydown/keyup
感谢
推荐答案
请务必prevent的焦点的默认行为
事件:
Make sure to prevent the default behavior of the focus
event:
focus: function (event, ui) {
this.value = ui.item.label;
event.preventDefault(); // Prevent the default focus behavior.
}
这篇关于jQuery UI的自动完成DownArrow中文UPARROW的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文