我想要做的是,只要用户关注,选择,然后他在键盘上点击 G 键,选项 Grapes 将被自动选中,当他再次按下 G 时,将会选择 Ginger 等等上。
我不知道该怎么做。
解决方案DEMO
你所要求的是下拉列表的默认功能。
如果你想搜索下拉列表,你可以试试这个插件。 p>
jQuery可搜索的DropDown插件演示
DEMO - 带您的代码
$('#fruits')。searchable() ;您也可以尝试 DEMO
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 select, 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.
解决方案DEMO
What you are asking for is the default functionality of drop-down-list.
if you want to search the drop-down-list you can try this plugin.
jQuery Searchable DropDown Plugin Demo
DEMO - with your code
$('#fruits').searchable();you can also try DEMO
更多推荐
HTML选择标记自动完成
发布评论