試試這個:
<html>
<head>
<style>
html, body
{
margin :0;
padding :0;
}
.hiddenElem
{
position :absolute;
top :-1000px;
left :-1000px;
}
</style>
</head>
<body>
<div class="hiddenElem">
<select name="selectField" id="selectField">
<option value="1">One</option>
<option value="2">Two</option>
</select>
</div>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript">
setTimeout(function()
{
var element=$("#selectField")[0], worked=false;
if(document.createEvent)
{
var e=document.createEvent("MouseEvents");
e.initMouseEvent("mousedown", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
worked=element.dispatchEvent(e);
}
else if(element.fireEvent)
{
worked=element.fireEvent("onmousedown");
}
if(!worked)
{
alert("It didn't worked in your browser.");
}
}, 100);
</script>
</body>
</html>
參考:How to open the select input using jquery
感謝您的回答,但不幸的是這沒有工作,至少不是我的測試設備(鉻43.0.2357.93在Android 4.2上運行。 2)。 – Schlaus
因爲https://www.chromestatus.com/features/5718803933560832 – Hampus