jQuery Autocomplete Categories Select Label and Value

chrisk picture chrisk · Jul 16, 2011 · Viewed 63.9k times · Source

Trying to get the jQuery Autocomplete with categories to return the selected value to the search field and the value to a separate input field.

I have modified the data to have a value as well as label and category.

See http://jsfiddle.net/chrisk/bM7ck/

But the value is always returned to the search field instead of the label.

Answer

jk. picture jk. · Jul 16, 2011

That's how the jquery ui autocomplete works when you supply both a label and a value. If you want the label returned to the search field, then rename the value field.

Updated fiddle: http://jsfiddle.net/jensbits/bM7ck/3/