The Auto suggest typeahead conundrum

07 Nov 2006

UPDATE AGAIN: apparently this IS working on safari, so there you go..UPDATE : apparently this isn't working on safari, any mac devs out there that are interested, I don't have a mac, so testing is a problem....

So I wanted to do an autosuggest type box, along the lines of google suggest, or the flickr tags.

I found this example at codeproject , which seemed to do the right thing, but as the comments suggest, its crazy heavyweight.. To run the example you need a database, need to compile the project, etc.. etc... Seemed unnecessary. Also, the javascript was > 80k , huge.

It turned out almost all of this javascript was the Google XSLT libraries, which were being used to simply draw 1 div. Also, this example had no keyboard handling, or multi-word support.

So, I've created the 'skinny typeahead demo' , this is dramatically smaller (javascript file is 7k) and runs without a database or server side script (for the demo, your implementation will need something to provide the word suggestions).

This demo supports keyboard control (up/down arrow, enter key to select) , as well as comma separated words, so if you use a comma, it will start providing suggestions based on the word after the comma.