diff --git a/README b/README.md similarity index 57% rename from README rename to README.md index ecbfb8d..03896fe 100644 --- a/README +++ b/README.md @@ -1,18 +1,4 @@ -jQuery Tags Input Plugin 1.3.2 - -Copyright (c) 2011 XOXCO, Inc - -Documentation for this plugin lives here: -http://xoxco.com/clickable/jquery-tags-input - -Licensed under the MIT license: -http://www.opensource.org/licenses/mit-license.php - -The git repository for this plugin can be found at: -https://github.com/xoxco/jQuery-Tags-Input - -ben@xoxco.com ------------------------------------------------------- +# jQuery Tags Input Plugin Do you use tags to organize content on your site? This plugin will turn your boring tag list into a @@ -22,56 +8,61 @@ all the data - your form just sees a comma-delimited list of tags! -Instructions +[Get it from Github](https://github.com/xoxco/jQuery-Tags-Input) + +[View Demo](http://xoxco.com/projects/code/tagsinput) + + +## Instructions First, add the Javascript and CSS files to your
tag: - - + + 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. - + Then, simply call the tagsInput function on any field that should be treated as a list of tags. -$('#tags').tagsInput(); + $('#tags').tagsInput(); 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' + }); If you're using the bassistance jQuery.autocomplete, which takes extra parameters, 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. -$('#tags').addTag('foo'); -$('#tags').removeTag('bar'); + $('#tags').addTag('foo'); + $('#tags').removeTag('bar'); You can import a list of tags using the importTags() function... -$('#tags').importTags('foo,bar,baz'); + $('#tags').importTags('foo,bar,baz'); You can also use importTags() to reset the tag list... -$('#tags').importTags(''); + $('#tags').importTags(''); And you can check if a tag exists using tagExist()... -if ($('#tags').tagExist('foo')) { ... } + if ($('#tags').tagExist('foo')) { ... } If additional functionality is required when a tag is added or removed, you may specify callback functions via the onAddTag and onRemoveTag parameters. Both @@ -91,19 +82,18 @@ option to false. Options -$(selector).tagsInput({ - 'autocomplete_url': url_to_autocomplete_api, - 'autocomplete': { option: value, option: value}, - 'height':'100px', - 'width':'300px', - 'interactive':true, - 'defaultText':'add a tag', - 'onAddTag':callback_function, - 'onRemoveTag':callback_function, - 'onChange' : callback_function, - 'removeWithBackspace' : true, - 'minChars' : 0, - 'maxChars' : 0 //if not provided there is no limit, - 'placeholderColor' : '#666666' -}); - + $(selector).tagsInput({ + 'autocomplete_url': url_to_autocomplete_api, + 'autocomplete': { option: value, option: value}, + 'height':'100px', + 'width':'300px', + 'interactive':true, + 'defaultText':'add a tag', + 'onAddTag':callback_function, + 'onRemoveTag':callback_function, + 'onChange' : callback_function, + 'removeWithBackspace' : true, + 'minChars' : 0, + 'maxChars' : 0 //if not provided there is no limit, + 'placeholderColor' : '#666666' + }); \ No newline at end of file diff --git a/test.html b/example.html similarity index 75% rename from test.html rename to example.html index dbe6719..2dea0a5 100644 --- a/test.html +++ b/example.html @@ -1,12 +1,7 @@ - - - - -