3

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>
SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
user259727
  • 31
  • 1
  • 2

2 Answers2

2

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.

Rex M
  • 142,167
  • 33
  • 283
  • 313
1

I would recommend using a comboBox. That should allow you to do what you want.

http://simpletutorials.com/?path=tutorials/javascript/jquery/ddcombobox

Matthew Smith
  • 1,287
  • 1
  • 9
  • 19