bozComplete is an unobtrusive autocomplete JavaScript library for autocompleting preset words in an input box.
It uses binary search and merge sorting for speed, javascript objects for code cleanliness, cross-platform support tested on IE, Firefox, Safari and Opera, and optional term ranking.
Even on a relatively slow machine, bozComplete can handle choosing from over 50k completions while still remaining responsive. Try it out yourself.
Add the class ‘autocomplete’ to any input boxes you wish to have autocomplete. (note: they must have an id.)
Include the line: Autocomplete.defaultSuggestTags = ‘alphabetized suggest words’;
That’s it.
If you want the autocomplete box to layer next to your input box, here are some suggested CSS rules by which you can do this:
Additional capabilities
bozComplete also offers the capability to customize the list of words to use for a specific input form. To do this, include a hidden input, with the id equal to = ’s’+id of the input to complete.
Additionally, bozComplete can order by a predetermined ranking. To use this feature, append a comma followed by a ranking number to each alphabetized autocomplete term.
To try this out, visit the test page. The test page offers a toggle for the number of search terms to complete on. An unlimited number of terms are supported by the script, however performance may suffer on slower machines if beyond 20,000 terms are used.
bozComplete does not support arbitrary capitalizations, only lowercase tags are supported currently. Uppercase tags will be lowercased.
If you add autocomplete inputs after the page has loaded, you will now need to call Autocomplete.findTargets() to let Autocomplete know to search for new inputs. This has been changed for performance reasons.