I have a simple html dropdown, I wants to use jQuery if possible to display all the options if this control has the focus(as if the user click on the dropdown). I have tried jQuery trigger(), click(), to avail.
<select id="single">
<option>Single</option>
<option>Single2</option>
</select>
Since the UI element that represents the drop-down-list comes from the host browser, it's not really inside the JS sandbox - rather, we merely have a DOM object that represents the things about the element we can manipulate - option list, style, and which index is selected. The behavior of interacting inside the element - expanding/collapsing, etc happens at the browser chrome level - same as tabs, file menu, etc. - outside the JS sandbox. The standard does not call for notifying the DOM when the DDL is opened, only when it is focused.
So, short answer - no.
I would recommend using a comboBox. That should allow you to do what you want.
http://simpletutorials.com/?path=tutorials/javascript/jquery/ddcombobox
精彩评论