views:

30

answers:

1

Hi, I have a php script which generates JS array in this form

new Array(

    new Array("Maine", 1), 

    new Array("Maryland", 2), 

    new Array("Massachusetts", 3), 

    new Array("Michigan", 4), 

    new Array("Minnesota", 5), 

    new Array("Mississippi", 6), 

    new Array("Missouri", 7), 

    new Array("Montana", 8)

);

can some one please suggest , how to implement a Auto Suggestion for the search form ?

Thanks

+1  A: 

Use jQuery UI autocomplete:

Autocomplete can be customized to work with various data sources, by just specifying the source option. A data source can be:

  • an Array with local data
  • a String, specifying a URL
  • a Callback

The local data can be a simple Array of Strings, or it contains Objects for each item in the array, with either a label or value property or both. The label property is displayed in the suggestion menu. The value will be inserted into the input element after the user selected something from the menu. If just one property is specified, it will be used for both, eg. if you provide only value-properties, the value will also be used as the label.

Jakub Konecki