【问题标题】:jQuery autocomplete plugin not focusing the next clicked fieldjQuery自动完成插件不关注下一个点击的字段
【发布时间】:2010-10-13 17:30:37
【问题描述】:
【问题讨论】:
标签:
jquery
jquery-plugins
autocomplete
【解决方案1】:
我很乐意为您查看代码,请取消注释此行:
// TODO provide option to avoid setting focus again after selection? useful for cleanup-on-focus
input.focus();
在jquery.autocomplete.js 行583。
【解决方案2】:
解决方法是:
注释掉解压版的第 308-310 行:
//if (wasVisible)
// position cursor at end of input field
//$.Autocompleter.Selection(input, input.value.length, input.value.length);
从 Luca 的帖子中,注释掉第 510 行:
//input.focus();
这两个都需要注释掉才能正常工作。
【解决方案3】:
如果用户使用 Enter 键或 TAB 键呢?那么如何阻止插件在输入字段中设置焦点?
你也让它工作,或者只有当用户使用鼠标从下拉列表中选择时?