I'm using jQueryUI autocomplete, and I have a function mapped to the select event, e.g.:
$("#someId").autocomplete({ source: someData, select: function (event, ui) { ... }, focus: function (event, ui) { ... } });
I have a special case: The user has focused on an item in the autocomplete drop-down (but not selected it) and I need to trigger the select event manually from a different function. Is this possible? If so, how?
HTML | <select> autocomplete Attribute on: It is the default value. When the autocomplete attribute is set to on the browser will automatically complete the values based on which the user entered before.
Option - appendTo By default its value is null. When the value is null, the parents of the input field will be checked for a class of ui-front.
In the process of searching a specific value, the jQuery UI autocomplete selection feature provides the user with some string suggestions for the input area which effectively saves time. The autocomplete select action is triggered when the user selects one of the options from the pre-populated list.
Here's what worked for me:
$(this).data('ui-autocomplete')._trigger('select', 'autocompleteselect', {item:{value:$(this).val()}});
You could do:
$("#someId").trigger("autocompleteselect");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With