链接到小提琴: http: //jsfiddle.net/nEapJ/(工作)
var items = [{
label : 'a',
value : 'a',
},{
label : 'b',
value : 'b',
},{
label : 'c',
value : 'c',
}];
$('input').autocomplete({
source : items
});
此代码有效,但是当我想通过回调函数设置源时,它不起作用
链接到小提琴: http: //jsfiddle.net/B3RWj/(不工作)
$('input').autocomplete({
source : function(request, response){
response(items);
}
});
当我输入“a”时,它会给出 a,b,c 作为结果。
那么,我错过了什么?
提前致谢。