views:

21

answers:

1

http://jqueryui.com/demos/autocomplete/

Basically my issue is that when the user uses the tab key to select an item, the next form field gets the focus, but unless the input is empty, I want the focus to stay on the input.

$('.ui-autocomplete').keypress(function(event) {
    if(event.keyCode == '9') { // Tab
        console.log('test');
    }
});

I thought the above code might work (or doing the function on the actual li items generated by jQuery UI), but no dice.

Any ideas? I know I'm close but I just can't figure out what element I need to tie this to.

A: 

Figured out that I needed to use the same code I used before on the input, but use "keydown" instead of "keypress".

Shawn Collier