我使用jQuery UI的自动完成程序与创建它的方式略有不同.
基本上我想保留所有相同的功能,唯一的区别是当出现建议框时,我不会在用户进行选择时隐藏建议框,我也不希望该选择填充输入框.autocomplete附加到.
所以,我一直在阅读jQuery UI文档,看来有一种方法可以禁用Select:和Close:事件,但我发现他们解释它的方式非常混乱,因此,这就是为什么我我在这里寻求帮助.
我的jQuery
$( "#comment" ).autocomplete({
source: "comments.php",
minLength: 4,
// Attempt to remove click/select functionality - may be a better way to do this
select: function( event, ui ) {
return false;
},
// Attempt to add custom Class to the open Suggestion box - may be a better way
open : function (event, ui) {
$(this).addClass("suggestion-box");
},
// Attempt to cancel the Close event, so when someone makes a selection, the box does not close …Run Code Online (Sandbox Code Playgroud)