我的标签编辑器正在使用支持Select2的标签,我知道您可以通过输入标签并按“Tab”键来添加不存在的标签
我的问题是:我不希望任何标签包含空格,例如“space tag”,
因此,有什么方法可以将“空格”键设置为新的标记触发器?
最佳答案
(在问题编辑中作答。转换为社区Wiki答案。请参阅Question with no answers, but issue solved in the comments (or extended in chat))
OP写道:
$("#e20").select2({
tags:["red", "green", "blue"],
tokenSeparators: [",", " "]
});