【发布时间】:2014-03-11 09:12:23
【问题描述】:
我在我的网站上使用 Twitter typeahead,它运行良好。但是当我尝试动态添加新输入时它不起作用。可能是什么问题呢?
感谢您的回复。
var custom = new Bloodhound({
datumTokenizer: function(d) { return d.tokens; },
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: 'http://'+window.location.hostname+'/invoice/loadItemOption?query=%QUERY'
});
custom.initialize();
$('.typeahead_option_items').typeahead(null, {
name: 'item_title[]',
displayKey: 'invoice_item_option_title',
source: custom.ttAdapter(),
hint: (App.isRTL() ? false : true),
}).on('typeahead:selected', function (obj, value) {
console.log(value.invoice_item_option_title);
});
【问题讨论】:
标签: jquery typeahead.js twitter-typeahead