如何使用Bootstrap标签提交标签使用空格键输入插件? [英] How to submit a tag with Bootstrap Tags Input plugin with space key?
问题描述
我正在构建一个包含使用引导标记输入插件的字段的表单一>。一旦用户点击 Enter 键,此插件就会输入一个标记。
I'm building a form with a field that is using the Bootstrap Tags Input plugin. This plugin inputs a tag once the user clicks the Enter key.
任何人都可以帮助使用该插件的文档来输入一个标签一旦用户在字段中放置,(逗号)或空格?
Can anyone help use the documentation of the plugin to input a tag once the user puts a "," (comma) or a space in the field?
这是文档 - http://timschlechter.github.io/bootstrap-tagsinput/examples/
推荐答案
您需要指定 confirmKeys
参数。从文档中,默认只有enter(13)的键码,但你可以像这样添加逗号(44)和空格(32)的代码:
You need to specify the confirmKeys
parameter. From the documentation the default is to only have keycode for enter (13), but you can add the code for comma (44) and space (32) like this:
$('input').tagsinput({
confirmKeys: [13, 32, 44]
});
这篇关于如何使用Bootstrap标签提交标签使用空格键输入插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!