I have a text input element that uses jQuery UI autocomplete. The input has an onchange event associated with it to change some other form values ββbased on the user's choice. I also want to change these other form values ββwhen the user selects an option from autocomplete.
The problem is that if the user searches for βbeerβ but only βbeeβ and then clicks on the beer option in autocomplete, the input exchange signal changes with the value βbeeβ, and then autocomplete select the response function (with the correct value for βbeerβ "). Since both of these handlers use the ajax call to find some things, I get into a race state.
My question is: is there a way that I can have onchange either not light up or interrupt when the user clicks on the autocomplete option. Note: this happens only when the button is pressed, selecting an option using only the keyboard does not lead to loss of input.
It is not an option for me to simply disable onchange completely when autocomplete is active, since it is plausible that the user will just continue typing and exit the input without selecting anything from autocomplete.
I made a small console console.log (), and the onchange event fires before all other events that I can think of, including input focus, autofill object focus, etc.
source share