我有以下代碼 -jQuery的自動完成(devbridge)lookupFilter搜索多個屬性
$(function() {
var fruits = [
{ value: 'Apple',id: '123', data: 'Apple' },
{ value: 'Pear', id: '543', data: 'Pear' },
{ value: 'Carrot', id: '123', data: 'Carrot' },
{ value: 'Cherry', id: '234', data: 'Cherry' },
{ value: 'Banana', id: '543', data: 'Banana' },
{ value: 'Radish', id: '3423', data: 'Radish' }
];
$("#autocomplete").autocomplete({
lookup: fruits,
onSelect: function (suggestion) {
alert('You selected: ' + suggestion.value + ', ' + suggestion.data);
},
});
});
我想基於「價值」和「ID」既做搜索。有lookupFilter函數,但我不知道如何使用它。這裏是原始腳本 - https://www.devbridge.com/sourcery/components/jquery-autocomplete/ 這裏是一些similer問題 - jQuery autocomplete (devbridge) search from beginning
請幫助!
沒有Vijay..Not工作。 –
謝謝...我改變了><,它的工作。 –
您確定自己喜歡'suggestion.value.toLowerCase()。indexOf(queryLowerCase)<-1'。如是;那麼我會更新答案,以便其他人可以參考它 – vijayP