I’m trying to get a jQuery autocomplete instance to open on the textbox focus, and fetch data from the remote source. An approximation of my attempt is shown here:
The problem with this is that you’ll note the extra call to the textbox focus method when you select a value from the dropdown. I can’t figure out a way to prevent this extra call, as it is interfering with the functionality.
Is there a better way to do what I’m trying to achieve?
Here’s a solution that’s not too hacky:
Updated example: http://jsfiddle.net/9x3hu/
If you’re curious, here’s the line that’s causing you grief. Looks like after you select an item, the
inputtargeted by the widget is focused automatically.This might seem odd, but it probably has to do with using the
UPandDOWNarrows to navigate the dropdown list. In that case, you’d want focus to return to theinput.