JQuery UI Autocomplete.result is not a trouble feature

I did a few searches, and this seems to be not uncommon, but none of the published solutions seem to work for me.

I tried several different methods:

jQuery(document).ready(function(){ jQuery( "#on-good-terms-add-term" ).autocomplete({ source: ongoodtermsavailableTags, }); jQuery( "#on-good-terms-add-term" ).result(function(event, data, formatted) { alert(data); }); }); 

and

 jQuery(document).ready(function(){ jQuery( "#on-good-terms-add-term" ).autocomplete({ source: ongoodtermsavailableTags, }).result(function(event, data, formatted) { alert(data); }); 

});

Both give me the same console error. I would be grateful for any help. Thanks

+7
source share
2 answers

To trigger an event when the user selects a search result using the jQuery UI widget auto-complete , you can initialize your constructor as follows with an event handler for "select":

 jQuery("#on-good-terms-add-term").autocomplete({ source: ongoodtermsavailableTags, select: function(e, ui) { alert("User selected: " + ui.item.value); } }); 
+9
source

My mistake was that I had the autocomplete-rails.js file as well as the provided rails.js in my resources / javascripts folder. Deleting a file was the solution

0
source

All Articles