event for show/hide list with options of < select > element

核能气质少年 提交于 2019-12-13 08:39:13

问题


All!!!

What events should be used when showing or hiding the dropdown list of < option >'s of < select > element?

Actions:

  1. The user press key (Enter for example) or clicked the cursor on an < select > item and was showed dropdown list of < option >'s

  2. The user press key (Esc for example) or select other html element and was hidded dropdown list of < option >'s

    item #1 item #1 item #1

    $('#myselect').on('event_show_dropdrown_list', function(){}); $('#myselect').on('event_hide_dropdrown_list', function(){});


回答1:


focusin() and focusout() jquery methods should do what you are looking for

https://api.jquery.com/focusin/



来源:https://stackoverflow.com/questions/38974201/event-for-show-hide-list-with-options-of-select-element

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!