How can I force the select element to dropdown using Javascript? Is it possible?
<select id="MiamiPlayers">
<option value="0">Bosh</option>
<option value="1">Wade</option>
<option value="2">LeBron</option>
</select>
<input type="button" onclick="Show()" />
<script type="text/javascript">
function Show()
{
//force the select to dropdown...
}
</script>
Thanks in advance!
You can't open the drop down, but you can do something like this:
document.getElementById('MiamiPlayers').setAttribute('size', 3);
See http://jsfiddle.net/MdCBB/
See Display DropDown options on Focus
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With