Tag-it! with autocomplete
An example of Rails application with multiple tag select box using Tag-it! jQuery plugin and autocomplete.
http://tag-it-autocomplete.heroku.com/
- Clone the repo with
git clone git://github.com/makaroni4/tag-it-autocomplete.git
* rake db:migrate
* rake tags:seed
* rails s
Added 'show_tag_url' option. If it is specified each tag will become a link with path show_tag_url/tag.
Pay attention, that if onTagClicked and show_tag_url options are both specified after onTagClicked there will be redirect to tag page.
$(document).ready(function() {
$("#mytags").tagit({
tagSource: function(search, showChoices) {
var that = this;
$.ajax({
url: "/tags/autocomplete.json",
data: {q: search.term},
success: function(choices) {
showChoices(that._subtractArray(choices, that.assignedTags()));
}
});
},
show_tag_url: "/tags/",
singleField: true,
singleFieldNode: $('#submit_tag_names')
});
});
- agentcooper for helping with autocomplete