![](/img/trans.png)
[英]Typeahead plugin and Bootstrap Tags input plugin Meteor not working
[英]bootstrap3.0 typeahead plugin not working
我正在嘗試提前完成自動完成工作,但沒有看到它正在工作。
$('#selectAgent').typeahead({
source: function(query, process) {
objects = [];
map = {};
var data = [{"id":1,"label":"machin"},{"id":2,"label":"truc"}] // Or get your JSON dynamically and load it into this variable
$.each(data, function(i, object) {
map[object.label] = object;
objects.push(object.label);
});
process(objects);
},
updater: function(item) {
$('id').val(map[item].id);
return item;
}
});
// HTML:
<input name="selectAgent" type="text" id="selectAgent" class="validate[required] text-input form-control" data-prompt-position="topLeft:70" placeholder="type "Agent name or id "" title="type "Agent name or id "" >
正如Marwan所指出的,Typeahead已從Bootstrap中刪除。 如果您包含以下庫,則代碼實際上可以正常工作:版本2.3.2中的http://getbootstrap.com/2.3.2/assets/js/bootstrap-typeahead.js
。
這是工作中的小提琴 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.