1、引入jQuery和jQuery.tag-editor的包
- jQuery.tag-editor的包包括css和js
- jQuery的包一定要放在tag-editor的上面!!!!!!
2、创建一个tag-editor
$("#tag").tagEditor({
placeholder:"添加完标签后请按enter~"
})
3、其他属性
Settings
Property | Default | Description | ||||
---|---|---|---|---|---|---|
initialTags | [] | Initial tags as an array of strings.初始标记为字符串数组。 | ||||
maxTags | null | Maximum number of allowed tags.允许的最大标签数。 | ||||
maxLength | 50 | maxlength attribute of the tag input field.标签输入字段的maxlength属性。 | ||||
delimiter | ',;' | Required string of delimiters - characters for separating tags. The first character is used as default delimiter in the (hidden) original field.必需的分隔符字符串 - 用于分隔标记的字符。第一个字符用作(隐藏)原始字段中的默认分隔符。 | ||||
placeholder | '' | Placeholder text for empty tag editor.空标记编辑器的占位符文本。 | ||||
forceLowercase | true | Lowercase all tags.小写所有标签。 | ||||
removeDuplicates | true | Automatically remove duplicate tags.自动删除重复的标签。 | ||||
clickDelete | false | Delete tags on right click and on Ctrl+click.右键单击并按住Ctrl +单击删除标签。 | ||||
animateDelete | 175 | Animate duration for deletion of tags in milliseconds. Set to 0 for non-animated removal.删除标签的动画持续时间(以毫秒为单位)。设置为0表示非动画删除。 | ||||
sortable | true | If jQuery UI sortable is available and this option is set to true, tags are sortable by drag and drop.如果jQuery UI sortable可用且此选项设置为true,则可以通过拖放对标签进行排序。 | ||||
autocomplete | null | jQuery UI autocomplete options as key/value pairs object. If provided, jQuery UI autocomplete must be loaded additionally.
|