At the time of click on a <div>
the <select>
should open.
That way I can open <select>
.
$('.teste').click(function(){
var element = $('#select')[0];
var ev = new MouseEvent('mousedown');
element.dispatchEvent(ev);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><selectid="select">
<option>1</option>
<option>2</option>
<option>3</option>
</select>
<div class="teste">Aperte-me</div>
The code however does not work in Firefox.
What's more, MDN
documents MouseEvent
.
How do I get mousedown
on <select>
in Firefox?