0

I have a select and a label. Now on click of the label I want the select box to open. What is the best way to do this?

<label>         
    <select id="Place" data-bind="options: Titles, optionsCaption: 'Going?', optionsValue: 'place', value: Location"></select>
</label>

Does anyone know how I can, when the label is clicked, open the select? I would prefer a javascript option as it means it will be called everytime, as I am having a Internet explorer issue.

Anubhav
  • 7,138
  • 5
  • 21
  • 33
Pete Tong
  • 51
  • 1
  • 6
  • 1
    when you click a `select` it will open and your `select` is the only thing in the `label`. So is it not doing what you want already? If you want them completely separated, I'm not sure it's possible. – Rhumborl Nov 18 '14 at 15:40
  • You can't without actually clicking on the `select`. [See here](http://stackoverflow.com/questions/430237/is-it-possible-to-use-js-to-open-an-html-select-to-show-its-option-list) – Spencer Wieczorek Nov 18 '14 at 15:42
  • as @Rhumborl said me too dont think it can be done as opening select box cannot be accessed from js it is browser event – shaN Nov 18 '14 at 15:42
  • 1
    Here are some ways to do it http://stackoverflow.com/questions/249192/how-can-you-programmatically-tell-an-html-select-to-drop-down-for-example-due – John Nov 18 '14 at 15:56

1 Answers1

0

The problem is your select does not have any options in it, therefore it cannot display any data when clicked. If you give your select options then you will be able to pick items. Look at this fiddle: http://jsfiddle.net/zndwsb12/

Travis Pettry
  • 1,220
  • 1
  • 14
  • 35