Auto-suggest Jquery plugin fix

Jquery plugin is an upgrade and fix of a good looking Autosuggest Jquery plugin, originally written by Drew Wilson. It has the following improvements:

  1. Works well on IE 7, 8 and chrome as well as FireFox 2
  2. Provides a UI that uses the native textbox – so clicking “back” works more intuitively
  3. provide a single select option – a better fit to most website requirements
  4. provides CSS for small and large search boxes

Simple usage


$("input[type=text]").autoSuggest("http://somesite.com/path_to_script",
 {minChars: 2, matchCase: false});

Advance usage can be found in the original project page – be sure to access it with Chrome or FF3, otherwise that site does not show properly.

Demo

Demo of this plugin can be found here, really hard to miss the search box there.

Download

Source code can be found here:

Auto-suggest CSS

Auto-suggest Javascript

Comments (7)

Thank you :) we’re now using this.

It’s a good plugin, however, you didn’t cover utilizing a MySQL Database (or flatfile, or any sort of access list). You missed a key element to making this work, sure, we have the auto suggest, but where are we pulling the ‘suggestions’ from?

@Adam A – this is a jQuery plugin so I did not implament the serverside – it is server side agnostic (AKA, java, php .NET, whatever). But point taken, I will try to post an example soon.

Hey there, Iv been trying to convert this code for use with codeigniter, but i am having a few issues. i’m not sure if I have done it wrong or weather I am passing the data to the js wrong. I have deleted ‘ “?”+opts.queryParam+”=”+ ‘ from line 243 so that i can pass the string to the function on the controller but now It doesn’t show the “drop down selector box” (autosuggest) once I type something into the input. I thought that it may have been the way im passing the results from the function back to JS which is:

$data = $this->search->sql($sql);
echo json_encode($data);

$sql being the mysql query. any help with this would be greatly appreciated! thanks.

Nick.

Scrap my last comment, I forgot to set my “value” of object.

Thanks for the script fix! was exactly what I needed. I found Drew Wilson’s page first but was not quite what i wanted but you have made it perfect!

Thanks again.

Hi again,

I have this plugin working but i am wanting to also get the id of the username and put the value of the id into a hidden input but not sure how to do it. Im getting my data from a db. I guess my question is how do I tell it to also get the id and insert the id into a hidden input when I select a username. hope that makes sence thanks.

The best solution i´ve ever seen! Thanks for sharing!

Post a comment