And*_*ndy 25 jquery jquery-ui autocomplete arrow-keys jquery-ui-autocomplete
我在使用jQuery Autocomplete和移动DownArrow和UpArrow时遇到了一些问题?
问题似乎是这样的
<input id="autocomplete-input" value="">
focus: function (event, ui) {
$('#autocomplete-input').val(ui.item.label);
}
Run Code Online (Sandbox Code Playgroud)
这适用于MOUSE焦点 - 但是当我使用arrowUp
和arrowDown
- 它选择ui.item.id
了上面和上面ui.item.label
我该如何解决这个问题,以便:
input
VAL完全不改变[即它使用户输入项]input
使用的focused
val 更新val谢谢
And*_*ker 54
确保阻止focus
事件的默认行为:
focus: function (event, ui) {
this.value = ui.item.label;
// or $('#autocomplete-input').val(ui.item.label);
// Prevent the default focus behavior.
event.preventDefault();
// or return false;
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
21547 次 |
最近记录: |