I try to create an autocomplete field with jQuery autocomplete widget, but it seems that does not work for some reason.
The code I use is the following:
HTML
<input type="text" id="specialties" />
JavaScript
var $specialties = [
{
id : 107,
name : 'Painting'
},
{
id : 158,
name : 'Reading'
}
];
var $specialty_text_field = $('#specialties');
$specialty_text_field.autocomplete(
{
source : $specialties,
minLength : 3
}
);
And when I enter in the text field the text Pain I am getting as a result the text No search results.
What can be wrong with this code ?
#autocompleteand#specialties, which should be?