I am taking a look into the JQuery AutoComplete widget and wanted to create an example with the most simple and scaled down functionality possible. In the image to the left is an example of what this looks like in action. It is basically an HTML text area that is hooked up to a static array of options.
What is an AutoComplete Widget?
An AutoComplete widget basically does what it sounds like. It can be added to an HTML control such as a text input area so that once a user starts typing in the area a narrowing list of options appears. The simplest way to populate these options is using a hard-coded array (as I will illustrate in this example), but naturally such hard-coding is also the least flexible and maintainable.
Two other options for populating the AutoComplete widget are Ajax calls or a Callback. These two options are great since the data can dynamically be retrieved from a database or similar data source, and they also scale very well once your options arrays reach several hundred options in size.
Here is the code:
- AF-Design – Using jQuery UI’s Autocomplete to Populate a Form
- Net.tutsplus.com – How to Use the jQuery UI Autocomplete Widget
- JQuery User Interface – AutoComplete Documentation
- Return-true.com – AutoComplete Example
- Ajaxdaddy.com – Ajax AutoComplete Example
- Stackoverflow.com – jquery ui accordions within tabs