0

Is it possible to click on the label related to the select element and make it drop down as it would normally do if you clicked on the select element itself?

I have tried this and it doesn't work:

        <li>
            <div class="styled-select">
                <label for="lang">Languages</label>
                <select id="lang">
                    <option class="green">eng</option>
                    <option class="green">fr</option>
                </select>
            </div>
        </li>

The reason why I am asking this is that the label will be floated left and the select right.

Aessandro
  • 5,517
  • 21
  • 66
  • 139
  • It's not possible AFAIK. `Select` is handled by the user exclusively in that case. – Roko C. Buljan Apr 09 '14 at 14:17
  • possible duplicate of [Trigger a select form element to show its options (open drop down options list) with Javascript](http://stackoverflow.com/questions/3846735/trigger-a-select-form-element-to-show-its-options-open-drop-down-options-list) – Roko C. Buljan Apr 09 '14 at 14:28
  • possible duplicate of [click-trigger-on-select-box-doesnt-work-in-jquery](http://stackoverflow.com/questions/2895608/click-trigger-on-select-box-doesnt-work-in-jquery) – Roko C. Buljan Apr 09 '14 at 14:30
  • also more similar info [here](http://stackoverflow.com/questions/12622191/trigger-click-on-select-box-on-hover) – Roko C. Buljan Apr 09 '14 at 14:31
  • Thanks for the info, however they didnt help for this specific case. I will rethink about another solution. – Aessandro Apr 09 '14 at 14:36
  • 1
    Another solution is to mimick with JS a custom dropdown box styled with CSS. On click simply pass the value to the original hidden select element. – Roko C. Buljan Apr 09 '14 at 14:37

0 Answers0