529
votes

What solutions accomplish the same auto-completion that SO uses for entering tags?

There are plugins that can handle one word but I haven't seen any that handle multiple words.

6
I've created the best - github.com/yairEO/tagify - vsync
@vsync Added it to the list in the first answer. Unfortunately can't link directly to codepen.io due to not having any code in the answer - Joe Phillips
@JoePhilllips - maybe it will accept google URL shortened ones - vsync
@JoePhilllips - My plugin is better than the best one on the top of the list, and deserves to be on the top and I have good selling points for that. currently the top one on the list is bloated (x4 than mine), uses extra input element (bad for form serialization) and does not support commas or pasting tags with them. it does offer some features which are nice but unneeded for most cases. autocomplete should be used desperately IMHO - vsync

6 Answers

63
votes

Bootstrap: If you are using Bootstrap. This is a really good one: Select2

Also, TokenInput is an interesting one. First, it does not depend on jQuery-UI, second its config is very smooth.

The only issue I had it does not support free-tagging natively. So, I have to return the query-string back to client as a part of response JSON.


As @culithay mentioned in the comment, TokenInput supports a lot of features to customize. And highlight of some feature that the others don't have:

  • tokenLimit: The maximum number of results allowed to be selected by the user. Use null to allow unlimited selections
  • minChars: The minimum number of characters the user must enter before a search is performed.
  • queryParam: The name of the query param which you expect to contain the search term on the server-side

Thanks culithay for the input.

8
votes

This originally answered a supplemental question about the wisdom of downloading jQuery versus accessing it via a CDN, which is no longer present...

To answer the thing about Google. I have moved over to accessing JQuery and most other of these sorts of libraries via the corresponding CDN in my sites.

As more people do this means that it's more likely to be cached on user's machines, so my vote goes for good idea.

In the five years since I first offered this, it has become common wisdom.

5
votes
2
votes

Check this plugin:

How to use AJAX for loading the tags https://stackoverflow.com/a/7662534/1078027

1
votes

We just open-sourced this jquery plug-in Github: tactivos/jquery-sew.