你好,我正在使用typeahead jQuery庫。在鍵盤上調用鍵頭功能
我想在keyup中運行該函數,但它現在正在工作。
jQuery代碼:
$.typeahead({
input: '.js-typeahead-car_v1',
minLength: 1,
maxItem: 0,
order: "asc",
hint: true,
source: {
searchkey: {
url: {
type: "POST",
url: "/search",
data: {
myKey: "muvalue"
}
}
}
},
callback: {
onClick: function (node, a, item, event) {
$("#topsearchbtn").trigger("click");
},
}
});
HTML:
<input type="text" name="term" class="form-control input-sm js-typeahead-car_v1"
maxlength="64" placeholder="Search Entire store here..." id="tags" autocomplete='off' />
我怎麼能說上KEYUP $.typeahead({})
?
現在它不是每次都發送第一次請求的請求。
謝謝,但相同的搜索建議不來了。 –
這個函數被觸發,我對此毫無疑問。在你的情況下,也許你在typeahead方法中傳遞的對象是錯誤的。 –
@DeepParekh你可以嘗試使用typeahead函數中最少量的參數來確保事情正確。 –