我正在使用jQuery自动完成,并希望仅在用户键入至少2个字符时限制显示结果.怎么做?
chr*_*eva 19
作为记录:
用户在激活自动填充功能之前必须输入的最小字符数.零对于只有几个项目的本地数据很有用.当有很多物品时,应该增加,其中一个角色可以匹配几千个物品.
代码示例
使用指定的minLength选项初始化自动完成.
$( ".selector" ).autocomplete({ minLength: 0 });
在init之后获取或设置minLength选项.
//getter
var minLength = $( ".selector" ).autocomplete( "option", "minLength" );
//setter
$( ".selector" ).autocomplete( "option", "minLength", 0 );
minLengthIntegerDefault:1