1- jQuery Tags Input Plugin 1.3.2
2-
3- Copyright (c) 2011 XOXCO, Inc
4-
5- Documentation for this plugin lives here:
6- http://xoxco.com/clickable/jquery-tags-input
7-
8- Licensed under the MIT license:
9- http://www.opensource.org/licenses/mit-license.php
10-
11- The git repository for this plugin can be found at:
12- https://github.com/xoxco/jQuery-Tags-Input
13-
14- 15- ------------------------------------------------------
1+ # jQuery Tags Input Plugin
162
173Do you use tags to organize content on your site?
184This plugin will turn your boring tag list into a
@@ -22,56 +8,61 @@ all the data - your form just sees a comma-delimited
228list of tags!
239
2410
25- Instructions
11+ [ Get it from Github] ( https://github.com/xoxco/jQuery-Tags-Input )
12+
13+ [ View Demo] ( http://xoxco.com/projects/code/tagsinput )
14+
15+
16+ ## Instructions
2617
2718First, add the Javascript and CSS files to your <head > tag:
2819
29- <script src="jquery.tagsinput.js"></script>
30- <link rel="stylesheet" type="text/css" href="jquery.tagsinput.css" />
20+ <script src="jquery.tagsinput.js"></script>
21+ <link rel="stylesheet" type="text/css" href="jquery.tagsinput.css" />
3122
3223Create a real input in your form that will contain a comma-separated list of
3324tags. You can put any default or existing tags in the value attribute, and
3425they'll be handled properly.
3526
36- <input name="tags" id="tags" value="foo,bar,baz" />
27+ <input name="tags" id="tags" value="foo,bar,baz" />
3728
3829Then, simply call the tagsInput function on any field that should be treated as
3930a list of tags.
4031
41- $('#tags').tagsInput();
32+ $('#tags').tagsInput();
4233
4334If you want to use jQuery.autocomplete, you can pass in a parameter with the
4435autocomplete url.
4536
46- $('#tags').tagsInput({
47- autocomplete_url:'http://myserver.com/api/autocomplete'
48- });
37+ $('#tags').tagsInput({
38+ autocomplete_url:'http://myserver.com/api/autocomplete'
39+ });
4940
5041If you're using the bassistance jQuery.autocomplete, which takes extra
5142parameters, you can also send in options to the autocomplete plugin, as
5243described here.
5344
54- $('#tags').tagsInput({
55- autocomplete_url:'http://myserver.com/api/autocomplete',
56- autocomplete:{selectFirst:true,width:'100px',autoFill:true}
57- });
45+ $('#tags').tagsInput({
46+ autocomplete_url:'http://myserver.com/api/autocomplete',
47+ autocomplete:{selectFirst:true,width:'100px',autoFill:true}
48+ });
5849
5950You can add and remove tags by calling the addTag() and removeTag() functions.
6051
61- $('#tags').addTag('foo');
62- $('#tags').removeTag('bar');
52+ $('#tags').addTag('foo');
53+ $('#tags').removeTag('bar');
6354
6455You can import a list of tags using the importTags() function...
6556
66- $('#tags').importTags('foo,bar,baz');
57+ $('#tags').importTags('foo,bar,baz');
6758
6859You can also use importTags() to reset the tag list...
6960
70- $('#tags').importTags('');
61+ $('#tags').importTags('');
7162
7263And you can check if a tag exists using tagExist()...
7364
74- if ($('#tags').tagExist('foo')) { ... }
65+ if ($('#tags').tagExist('foo')) { ... }
7566
7667If additional functionality is required when a tag is added or removed, you may
7768specify callback functions via the onAddTag and onRemoveTag parameters. Both
@@ -91,19 +82,18 @@ option to false.
9182
9283Options
9384
94- $(selector).tagsInput({
95- 'autocomplete_url': url_to_autocomplete_api,
96- 'autocomplete': { option: value, option: value},
97- 'height':'100px',
98- 'width':'300px',
99- 'interactive':true,
100- 'defaultText':'add a tag',
101- 'onAddTag':callback_function,
102- 'onRemoveTag':callback_function,
103- 'onChange' : callback_function,
104- 'removeWithBackspace' : true,
105- 'minChars' : 0,
106- 'maxChars' : 0 //if not provided there is no limit,
107- 'placeholderColor' : '#666666'
108- });
109-
85+ $(selector).tagsInput({
86+ 'autocomplete_url': url_to_autocomplete_api,
87+ 'autocomplete': { option: value, option: value},
88+ 'height':'100px',
89+ 'width':'300px',
90+ 'interactive':true,
91+ 'defaultText':'add a tag',
92+ 'onAddTag':callback_function,
93+ 'onRemoveTag':callback_function,
94+ 'onChange' : callback_function,
95+ 'removeWithBackspace' : true,
96+ 'minChars' : 0,
97+ 'maxChars' : 0 //if not provided there is no limit,
98+ 'placeholderColor' : '#666666'
99+ });
0 commit comments