Get selected value from jqueryui autocomplete combobox
autocomplete, combobox, jquery, jquery-ui
Solution
First of all in a "normal" autocomplete you would get the value of the selected item by doing `ui.item.value`. In your case this doesn't work. Perhaps because the select function gets overridden.
Instead alert the value in your `autoCompleteSelect` function.
this._on(this.input, {
autocompleteselect: function (event, ui) {
/* THIS IS NEW */
alert(ui.item.value);
ui.item.option.selected = true;
this._trigger("select", event, {
item: ui.item.option
});
}
If you are curious what other options you could get in this function just do a `console.log(ui)` in it and open your console to see other options. All in all you don't even need to call the autocomplete widget anymore.
Updated fiddle
Problem
I'm trying to get selected value from jqueryui autocomplete combobox. Here is the Demo. I have added below code to get selected value. but it is not worked. ``` $( "#combobox" ).autocomplete({ select: function(event, ui) { alert($(ui).val()); } }); ``` How can I solve this?