For this dropdownlist in HTML:
<select id="countries">
<option value="1">Country</option>
</select>
I would like to open the list (the same as left-clicking on it). Is this possible using JavaScript (or more specifically jQuery)?
For this dropdownlist in HTML:
<select id="countries">
<option value="1">Country</option>
</select>
I would like to open the list (the same as left-clicking on it). Is this possible using JavaScript (or more specifically jQuery)?
This is spruced up from the answers just above and uses the length/number of options to conform to how many options there actually are.
Hope this helps somebody get the results they need!
I tried using mrperfect's answer and i had a couple glitches. With a couple small changes, I was able to get it to work for me. I just changed it so that it would only do it once. Once you exit dropdown, it would go back to the regular method of dropdowns.
Super simple:
i just added
and add into the select
to make the same appearance like the classic one (overlap the rest of html)
You can easily simulate a click on an element, but a click on a
<select>
won’t open up the dropdown.Using multiple selects can be problematic. Perhaps you should consider radio buttons inside a container element which you can expand and contract as needed.
No you can't.
You can change the size to make it larger... similar to Dreas idea, but it is the size you need to change.