JSFiddle - React, Tailwind, and code Playground
by Zay Lau
HTML
<div id="test">
<div>
Click
</div>
<br /><br />
<select>
<option>123</option>
</select>
</div>
JavaScript
(function($) {
"use strict";
$.fn.openSelect = function()
{
return this.each(function(idx,domEl) {
if (document.createEvent) {
var event = document.createEvent("MouseEvents");
event.initMouseEvent("mousedown", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
domEl.dispatchEvent(event);
} else if (element.fireEvent) {
domEl.fireEvent("onmousedown");
}
});
}
}(jQuery));
$('#test div').click(function(){
$('#test select').openSelect();
});