Okay, thank you.

But I dont know how to iterate through the values of
#autoSuggestionsList. They are like
 <li a href="#" onclick="myfunction();"> Hello1 </li>
 <li a href="#" onclick="myfunction();"> Hello2 </li>

Like this?   if (#autoSuggestionsList.next().is("li")) {
                     '#autoSuggestionsList.next().addClass
("selected");
                     ...
                 }


In the example you posted one can see:
 $(document).ready(function() {

That means the key event would affect the whole homepage? How to
activate this up/down arrow function only for the suggestion list ?


On 9 Jan., 18:32, Šime Vidas <sime.vi...@gmail.com> wrote:
> I forgot to mention: don't get freaked out by the code... basically
> what you need is:
>
>         $().keydown(function(e) {
>
>             if (e.keyCode === 40) {
>
>                     // down cursor key was pressed
>
>             } else if (e.keyCode === 38) {
>
>                     // up cursor key was pressed
>
>             }
>
>         });

Reply via email to