[英]Jquery Autocomplete Minimum length
Currently my autocomplete returns values after one character is entered. 目前,我的自动填充功能在输入一个字符后会返回值。 I simply want to increase that limit to 3 but can't get that to work.
我只是想将该限制增加到3,但无法正常工作。 Here is my code below.
这是下面的代码。 As you can see I've tried adding minLength: 3 outside and also inside the source but to no avail.
如您所见,我尝试在源代码的内部和外部添加minLength:3,但无济于事。
$(function() {
$( "#name" ).autocomplete({
source: '${g.createLink(controller: 'template', action: 'suggestedNameValues')}'
//minLength: 3
});
});
Any ideas? 有任何想法吗?
Update I was missing a comma at the end of the source line. 更新我在源代码行的末尾缺少逗号。
The default value of minLength is 1, which means the user to type at least 1 character in the search box to trigger the autocompletion. minLength的默认值为1,这表示用户在搜索框中键入至少1个字符以触发自动完成。
$(function() { $(function(){
$("#search").autocomplete(
{
source:data,
minLength:2
});
}); });
You're doing it all right, minLength
should be right where you've commented it. 您做的很好,
minLength
应该在您评论的地方正确。 Are you sure your browser doesn't use a cached copy of script or something like that? 您确定浏览器未使用脚本或类似内容的缓存副本吗?
update: by the way, is your source link correct? 更新:顺便说一句,您的源链接正确吗? I'd say this script won't run (though i'm not familiar with JS frameworks, may be it's pre-parsed before run).
我会说这个脚本不会运行(尽管我对JS框架不熟悉,可能是在运行前已预先解析的)。
Try adjusting your quotations in the source
: 尝试调整
source
的报价:
$(function () {
$("#name").autocomplete({
source: "${g.createLink(controller: 'template', action: 'suggestedNameValues')}",
minLength: 3
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.