To create an taginput widget simply call:
$('selector').taginput();
The element on which you create a taginput widget should be an input
element.
If you want to overwrite default options simply pass an object literal to the constructor:
$('selector').taginput( { option: value } );
To call methods related to the widget we use the jQuery UI widget style:
$('selector').taginput('add', 'someTag');
You can apply different ui-styles on the widget using the style
option.
Determines the ui style the widget is created with, which is either a preset (pass a String) or a custom style (pass an Object).
When passing an object, the following properties must be set:
{{label}}
as placeholder for the label.'jqueryui'
or 'bootstrap'
) or Object
'jqueryui'
Determines on which key codes a tag should be created.
[32, 13, 9]
(whitespace, enter, tab)
The value of the placeholder of the newly created input field.
'Add tag...'
Determines whether multiple tags with the same value are allowed.
false
Determines whether to treat tag values case-sensitive or not. In other words: Is the value 'Test'
unequal 'test'
?
false
Called when a tag value is added that already exists.
function($tag) { $tag.hide().fadeIn(); }
Called when a tag is added.
Return false
to avoid adding the tag.
Called when a tag is removed.
Return false
to avoid removing the tag.
Adds the given tag.
Removes the given tag if it exists.
Returns an array of the present tags values.
Clears all present tags and adds the given ones.
Clears all present tags.
Focuses the input field.
Returns the input field created for the widget.