我将在我的一个项目中使用Bootstrap TagsInput和Bootstrap Typeahead。
当我开始键入时,Typeahead将显示建议。如果我按[ENTER],它将正确地添加。但有一个问题,当我输入一些东西,并按下[逗号按钮,]它什么也不做。
这是我的输入:
<input type="text" autocomplete="false" id="tags" name="tags">
JS代码:
$('#tags').tagsinput({
confirmKeys: [13, 188],
typeahead : {
afterSelect: function(val) { this.$element.val(""); },
displayKey: 'text',
valueKey: 'value',
source: [
{ "value":"test1", "text":"test1" },
{ "value":"test2", "text":"test2" }
]
},
freeInput: true,
itemValue: 'value',
itemText: 'text',
});
change:confirmKeys: [13,188],
:confirmKeys: [13,44],