I have autocomplete code which shows a popup containing matches after a user has entered 3 characters or more in a text field. Standard stuff.
The pop up is simply a div, within which there is a list containing matches, e.g.
<div id="popup">
<ul>
<li><a href="/link1">Link 1</a></li>
<li><a href="/link2">Link 2</a></li>
</ul>
</div>
Question is, how can I make it so that when a user presses the tab
key from within the text input field, it jumps to the first in the list of <li>
elements?
Is this possible?
I tried setting tabindex
on the <li>
elements but this had no effect.
I'm using vanilla javascript, NOT JQuery