jQuery Autocomplete

Read more and download "jQuery Autocomplete"

This script is based on jQuery Autocomplete plugin made by PengoWorks.
It has many options and is quite easy to setup in your page.
You can pass advanced options as a JavaScript object, hashes etc.
It's easily to edit the style of the dropdown result box, there are a couple of css classes.

- You can use local arrays of data (in javascript arrays), so you don't have to use AJAX to query your server
- Limit you number of results dropdown to XX (good for limiting the results to users)
- Autofill pre-populates text box as you type
- New findValue() method can be used to programmatically determine if the value in the box is a valid option. (Useful for verifying the text entered is an existing value option.)
- Dropdown options now correctly re-position themselves on each display (which means they adjust for changing to the DOM)
- Dropdown box defaults to the width of the input field its attached to (you can manually specify a larger width as well)
- Better emulates Windows autocomplete boxes (for example: hitting delete and retyping the same box will now bring back the dropdown menu)




Visit PhpDaddy.com


Play with this script by changing the html bellow. Submit your changes by clicking on this bar. Refresh the page to reset changes.
Play with this script by changing the html above. Submit your changes by clicking on this bar. Refresh the page to reset changes.

Comment on this example

Name
Url
Comment
Captcha
 

 

1
Adam Cox
2008-04-17 20:11:22
Very nice article! I was going to use AJAX to get the data from the DB on the server, but this might be an easier approach.

2
Kevin
2008-03-21 11:50:31
this is really cool... i use script.aculo.us

3
Coto
2008-03-19 07:38:44
This is a bug!!! function requestData(q) { if (!options.matchCase) q = q.toLowerCase(); var data = options.cacheLength ? loadFromCache(q) : null; // recieve the cached data if (data && data != "") {

4
Viru
2008-03-06 08:56:34
thanks for the demo. very useful

5
Frank
2007-11-04 07:58:43
ver ynice

6
Miroslav
2007-10-03 23:37:52
Nice article :)

7
John
2007-06-15 00:36:31
Useful implementation of jQuery plugin. There are so many ways to add this to your html