I am trying to call a function every time an autocomplete search is changed, either by key press or by clicking one of the options of the autocomplete. Key press works fine like this...
$('#searchScenario').on('keyup change', function () {
//event
}
But this won't work when I click on one of the autocomplete options.
Here is my autocomplete initialization.
scenarioSearch = $('#searchScenario').autocomplete({
source: scenarioTags,
minLength: 0
}).focus(function () {
$(this).autocomplete('search', $(this).val());
});
I have attempted other methods such as this...
(function () {
var scenarioSearch = $("#searchScenario").autocomplete({
change: function() {
alert('changed');
}
});
scenarioSearch .autocomplete('option','change').call(scenarioSearch );
});
But it only triggers when the box loses focus.
Any help would be greatly appreciated.