That fires when a menu item gets focus. You want to fire the code Dave has in the focus function but on the focus of the input element rather than the autocomplete. To do that I think you might have to subclass the autocomplete widget. Not something I have done.