使用自定義引導插件預輸入功能 https://gist.github.com/1891669如何附加一個回調來引導插件事先鍵入的內容
如何安裝的「選擇」事件的回調? 以下代碼不起作用。
var selectedFn = $('.typeahead dropdown-menu').on('select', function(ev){
console.log(ev);
});
有人可以解釋這是如何工作的?
使用自定義引導插件預輸入功能 https://gist.github.com/1891669如何附加一個回調來引導插件事先鍵入的內容
如何安裝的「選擇」事件的回調? 以下代碼不起作用。
var selectedFn = $('.typeahead dropdown-menu').on('select', function(ev){
console.log(ev);
});
有人可以解釋這是如何工作的?
您可以只聽你的輸入改變事件是這樣的:
$('input.typeahead').on('change', function() { ... })
這樣做的一種新的方式是:
$('.input').typeahead({
// snip
}).on('typeahead:selected', function() {
// on selected
});
$('#myselector').typeahead({
itemSelected:function(data,value,text){
console.log(data)
alert('value is'+value);
alert('text is'+text);
},
//your other stuffs
});
你只是傳中itemSelected回調函數,它會給你選定的項目。
希望這會爲你工作。
輸入只在輸入失去焦點時觸發更改事件。 – Ziggy
然而這似乎是唯一對我有用的東西,謝謝! – Tumtum