http://jqueryui.com/demos/autocomplete/#event-change
It sounds like the change
event is supposed to fire after you've selected an item, but instead it seems to fire onblur, but only if the input has changed.
select
OTOH fires too early, it fires before the input text gets updated.
I want to do something with the input as soon as the user picks an item OR after the user types something and switches focus (like the usual change event).
How can I do that?
Nevermind, figured it out. We can cheat:
select: function(event,ui) {
this.value=ui.item.value;
$(this).trigger('change');
return false;
}
Set the value of the input manually, then trigger the change event manually, and return false so that it doesn't bother setting the input twice.
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