I have an HTML select element:
<select id='poetslist'> <option value="shakespeare">William Shakespeare</option> <option value="milton">John Milton</option> <option value="keats">John Keats</option> <option value="wordsworth">William Wordsworth</option> <option value="larkin">Phillip Larkin</option> </select>
In Chrome, when the page loads, the William Shakespeare option is selected. If the user starts typing Phil, the list focuses on Phillip Larkin . Familiar behavior.
What I would like to do (preferably using jQuery) also allows the user to enter the initials of the poet and enable the corresponding parameter.
So, if you typed JK , then the John Keats option should come into focus. JM and John Milton etc.
I donโt even know how the HTML select element works, regardless of whether it is different from different browsers, etc. - and it seems hard to find good documentation for this.
Can anyone figure out a smart way to do this in jQuery?
source share