A component that turns a text input element into a pretty tags input.
Enables you to work with any MVC framework using simple events or you can get the tags from the inner model.
- No Component and Emitter any more.
- Delete previous tag by backspace key.
- Able to import tags.
npm install https://github.com/gucheen/tag-input.git
var TagInput = require('tag-input');
var taginput = TagInput(document.getElementById('tags'))
taginput.bind('add', function (tag) {
console.log(tag + ' added')
console.log(taginput.tags())
})
taginput.bind('import', function (tagsList) {
console.log('import ' + tagsList.join(','))
console.log(taginput.tags())
})
taginput.bind('remove', function (tag) {
console.log(tag + ' removed')
console.log(taginput.tags())
})
taginput.importTags(['123', '234'])
The pseudo input style is very basic, so you can adjust its looks to your site, You can extend it by adding to taginputContainer class.
binds to a text input element
adds a tag to the tag input from js
adds a list of tags to the tag input from js
removes a tag from the tag input from js
Called when a tag is added
Called when a list of tags is import
Called when a tag is removed`