I am using the autocomplete plugin from devbridge (plugin page).
On the page where I am using it, I am actually inserting textboxes into a div via ajax after the page is loaded, so in order to apply the autocomplete plugin to those textboxes I am using the jQuery .on function like this…
$('body').on('change', '#rightColumn', function(){
$('.jobCode').autocomplete({
serviceUrl: 'jobCodeSearch_AJAX.cfm',
minChars: 2,
onSelect: function(suggestion) {
alert('chosen: ' + suggestion.data);
$(this).val(suggestion.data);
}
});
});
and I am manually triggerign the change event on #rightColumn when I insert the textboxes.
So with that said - this is only half working.
When i try typing in the inserted textbox, the results are coming up in the autocomplete as they should, but if I click on one of the result, it is not populating the textbox.
If I use my arrow keys to scroll down to one of the selections in the autocomplete and use the tab key to select it - it works every time, but clicking doesnt seem to work.
I am really not sure what I am doign wrong here - can anyone help??