Bootstrap Tags Input是一个jQuery插件,允许您使用Twitter Bootstrap用户界面添加、删除和分类标签。
新Bootstrap 4版本现已上市。
1.在网页上包括jQuery库和jQuery引导标签输入
<script src="assets/jquery.min.js"></script> <script src="assets/bootstrap-tagsinput.js"></script> <link rel="stylesheet" href="assets/bootstrap-tagsinput.css">
2.在网页上包含Twitter引导程序
<link rel="stylesheet" href="assets/bootstrap-2.3.2/css/bootstrap.min.css"> <script src="assets/bootstrap-2.3.2/js/bootstrap.min.js"></script>
3.为标签管理器创建一个输入字段
<input type="text" value="Amsterdam,Washington,Sydney,Beijing,Cairo" data-role="tagsinput" />
4.完成。您可以通过JS选项对象将选项传递给插件。
tagClass: function(item) {
return 'label label-info';
},
focusClass: 'focus',
itemValue: function(item) {
return item ? item.toString() : item;
},
itemText: function(item) {
return this.itemValue(item);
},
itemTitle: function(item) {
return null;
},
freeInput: true,
addOnBlur: true,
maxTags: undefined,
maxChars: undefined,
confirmKeys: [13, 44],
delimiter: ',',
delimiterRegex: null,
cancelConfirmKeysOnEmpty: false,
onTagExists: function(item, $tag) {
$tag.hide().fadeIn();
},
trimValue: false,
allowDuplicates: false,
triggerChange: true版本0.8.0(2022-04-11)
v0.7.1(2015年11月11日)
v0.7.0(2015年11月09日)
v0.6.1(2015年11月03日)
v0.5.1(2015年3月26日)
版本0.4.2(2014-08-01)
版本0.3.14(2014-07-31)
版本0.3.14(2014-07-27)
版本0.3.10(2014-07-17)
版本0.3.9(2013-10-15)
版本0.3.8(2013-10-15)
版本0.3.7(2013-10-15)
版本0.3.6(2013-10-06)