标签输入Bootstrap插件:Tokenfield
jopen
10年前
Tokenfield 是一个 Bootstrap 的扩展,用来实现在输入框中的标签输入。
var engine = new Bloodhound({ local: [{value: 'red'}, {value: 'blue'}, {value: 'green'} , {value: 'yellow'}, {value: 'violet'}, {value: 'brown'}, {value: 'purple'}, {value: 'black'}, {value: 'white'}], datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.value); }, queryTokenizer: Bloodhound.tokenizers.whitespace }); engine.initialize(); $('#tokenfield-typeahead').tokenfield({ typeahead: [null, { source: engine.ttAdapter() }] });