How to open select dropdown by button?
$('button').on('click', function() {
$('select').trigger('click');
});
My code: http://jsfiddle.net/UGkWp/
UPDATE:
I found solutions for webkit browsers, but only these browsers: http://jsfiddle.net/UGkWp/2/ Maybe You known how do this in each browsers?
You can do it with only CSS like this:
Visit this fiddle for more details: https://jsfiddle.net/ssjuma/1mkxw2nb/1/
This worked for me
$('select').focus();
http://jsfiddle.net/yqs90jdw/
I think you should have a look at this page:
Can I open a dropdownlist using jQuery
It seems like it is not possible to do this directly, but tools exists to emulate what you are trying to do.
An easy solution would be to use the "chosen"-plugin for jquery: http://harvesthq.github.io/chosen/
This also gives you some great advantages over normal selects, and its easy to use.
On this you can simply fire a "mousedown" event like the following:
Given you have chosen (and jquery) enabled on your page the following code should do the trick:
HTML:
JavaScript:
Notice that chosen automatically appends the "_chzn" to your dropdown-name, which is what you should use in your selector
I think this will help you..
Trigger documentation
Fiddle
Here
hope this help