Pergunta

I would like to scroll through the jQuery UI autocomplete suggestions when the user presses the tab key (and is simultaneously in the search field).

I believe that the answer to my question is closely related to the answer to the question already asked here.

$("#search").keypress(function (eventObject) {
   if (eventObject.keyCode==13){
      *what do I write here*
   };
};
Foi útil?

Solução

If I correctly understand your requirement then I don't think that exact scenario is supported with jQuery UI autocomplete. You can open the autocomplete drop down when you press tab and then use the arrow keys to move through the list of items.

// Setup
$("#search").autocomplete({
    minLength: 0,
    source: myItems
});

// Call on tab press
$("#search").autocomplete("search", "");
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top