mirror of
https://github.com/wahyd4/jQuery-Tags-Input.git
synced 2026-08-09 12:56:35 +10:00
wrap README lines
This commit is contained in:
@@ -26,23 +26,29 @@ First, add the Javascript and CSS files to your <head> tag:
|
||||
<script src="jquery.tagsinput.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="jquery.tagsinput.css" />
|
||||
|
||||
Create a real input in your form that will contain a comma-separated list of tags.
|
||||
You can put any default or existing tags in the value attribute, and they'll be handled properly.
|
||||
Create a real input in your form that will contain a comma-separated list of
|
||||
tags. You can put any default or existing tags in the value attribute, and
|
||||
they'll be handled properly.
|
||||
|
||||
<input name="tags" id="tags" value="foo,bar,baz" />
|
||||
|
||||
Then, simply call the tagsInput function on any field that should be treated as a list of tags.
|
||||
Then, simply call the tagsInput function on any field that should be treated as
|
||||
a list of tags.
|
||||
|
||||
$('#tags').tagsInput();
|
||||
|
||||
If you want to use jQuery.autocomplete, you can pass in a parameter with the autocomplete url.
|
||||
If you want to use jQuery.autocomplete, you can pass in a parameter with the
|
||||
autocomplete url.
|
||||
|
||||
$('#tags').tagsInput({autocomplete_url:'http://myserver.com/api/autocomplete'});
|
||||
$('#tags').tagsInput({
|
||||
autocomplete_url:'http://myserver.com/api/autocomplete'
|
||||
});
|
||||
|
||||
You can also send in options to the autocomplete plugin, as described here.
|
||||
|
||||
$('#tags').tagsInput({ autocomplete_url:'http://myserver.com/api/autocomplete',
|
||||
autocomplete:{selectFirst:true,width:'100px',autoFill:true}
|
||||
$('#tags').tagsInput({
|
||||
autocomplete_url:'http://myserver.com/api/autocomplete',
|
||||
autocomplete:{selectFirst:true,width:'100px',autoFill:true}
|
||||
});
|
||||
|
||||
You can add and remove tags by calling the addTag() and removeTag() functions.
|
||||
@@ -50,14 +56,15 @@ You can add and remove tags by calling the addTag() and removeTag() functions.
|
||||
$('#tags').addTag('foo');
|
||||
$('#tags').removeTag('bar');
|
||||
|
||||
If additional functionality is required when a tag is added or removed, you may specify
|
||||
callback functions via the onAddTag and onRemoveTag parameters. Both functions should
|
||||
accept a single tag as the parameter.
|
||||
If additional functionality is required when a tag is added or removed, you may
|
||||
specify callback functions via the onAddTag and onRemoveTag parameters. Both
|
||||
functions should accept a single tag as the parameter.
|
||||
|
||||
If you do not want to provide a way to add tags, or you would prefer to provide
|
||||
an alternate interface for adding tags to the box, you may pass an false into
|
||||
the optional 'interactive' parameter. The tags will still be rendered as per
|
||||
usual, and the addTag and removeTag functions will operate as expected.
|
||||
|
||||
If you do not want to provide a way to add tags, or you would prefer to provide an alternate
|
||||
interface for adding tags to the box, you may pass an false into the optional 'interactive' parameter.
|
||||
The tags will still be rendered as per usual, and the addTag and removeTag functions will
|
||||
operate as expected.
|
||||
|
||||
Options
|
||||
|
||||
|
||||
Reference in New Issue
Block a user