Creating An Autosuggest Textbox
It’s been a long time since I’ve had the extra time to write some articles. Now that my book is finished, I intend to get back to writing these articles. To that end, the first one is now up over at WebReference. This is the first in a three-part series on how to emulate Google Suggest functionality. Check it out: Creating an Autosuggest Textbox with JavaScript, Part 1.
Disclaimer: Any viewpoints and opinions expressed in this article are those of Nicholas C. Zakas and do not, in any way, reflect those of my employer, my colleagues, Wrox Publishing, O'Reilly Publishing, or anyone else. I speak only for myself, not for them.
Both comments and pings are currently closed.




6 Comments
It's a really great article, but the example page does seem to be working. (Looks like the "suggestions1.js" file is missing.)
I especially liked learning about the Partial Text Selection. I was wondering how that worked. Thanks! Looking forward to the next two parts.
Happy Steve on March 21st, 2005 at 12:49 pm
Sorry about that, I'll contact the editor at WebReference to fix it. In the meantime, the downloadable ZIP file contains all the necessary files.
Nicholas C. Zakas on March 21st, 2005 at 1:22 pm
Thank you for this very good article. The example and the download, however, doesn't don't at all. I tried it on the PC on IE 6, Firefox 1.0.2, Mozilla 7.1 and Opera 7.5 but there is no typeahead at all.
Frank Stahl on March 24th, 2005 at 4:35 am
I've double-checked the examples on both IE 6 and Firefox 1.0.1, and they seem to work fine. The example will not work on Opera, as there is no way to select only part of the text in a textbox. Remember, this example is case sensitive, so if you're typing "missouri", you'll get no suggestions; you need to type "Missouri" to get a suggestion.
Nicholas C. Zakas on March 24th, 2005 at 9:59 am
Good article. I'll probably buy your Wrox book.
The "AutoSuggest" concept isn't that new though. Matt Kruse offered an open source version called "AutoComplete" several years ago.
Keith Reed on March 29th, 2005 at 3:40 pm
Thanks Keith. I'm aware that the autosuggest functionality isn't all that new, and I'm aware of Matt's script. I also wrote an article in 2003 for Sitepoint explaining the autocomplete functionality as well (check out the Writing section). In any event, I hope you enjoy the next two parts of the article.
Nicholas C. Zakas on March 29th, 2005 at 7:12 pm
Comments are automatically closed after 14 days.