Sunday, 18 August 2013

HTML select tag autocomplete

HTML select tag autocomplete

I got some select tag as follows:
<select id="fruits">
<option value="1">Apple</option>
<option value="2">Banana</option>
<option value="3">Orange</option>
<option value="4">Grapes</option>
<option value="5">Ginger</option>
</select>
What I want to do is, whenever the user focus on the combo box, and he's
clicking on the key "G" in his keyboard, the option "Grapes" will be
automatically selected, and when he presses "G" once again, "Ginger" will
be selected and so on.
I have no clue how to do it.
Thanks in advance!

No comments:

Post a Comment