I’m using jQuery UI Autocomplete with some AJAX (the data isn’t pulled until after they stop typing). I would like to make it so once the data is found, Autocomplete will then pop-up as a search result. This works, however only when I start typing again (the dropdown doesn’t trigger until I type because it’s not initialized until after I stop typing).
My code:
var availableTags = [
"Perl",
"PHP",
"Python",
"Ruby"
];
$('input#mainSearchBox').autocomplete({
source: availableTags,
minLength: 0
});
$('input#mainSearchBox').data('autocomplete').menu.active;
The last part was an attempt to activate autocomplete, but it fails.
The search method should do the trick:
Fiddle