2009-03-04 67 views

回答

2

我去过还跟看代码对你来说,去掉这一行:

// TODO provide option to avoid setting focus again after selection? useful for cleanup-on-focus 
input.focus(); 

jquery.autocomplete.js线583

+0

嘿,很喜欢这个答案比第一更好:) – 2009-03-04 06:10:46

1

修复的方法是:

注释掉线的解压版本308-310:

//if (wasVisible) 
    // position cursor at end of input field 
    //$.Autocompleter.Selection(input, input.value.length, input.value.length); 

而且从卢卡的帖子,注释掉线510:

//input.focus(); 

这些都需要被注释掉以使其正常工作。

0

如果用户使用Enter键或TAB键,该怎么办?我怎样才能阻止插件在输入字段中设置焦点呢? 你是否也可以工作,或者只有当用户使用鼠标从下拉菜单中进行选择?