Javascript examples for DOM HTML Element:Select
Select size Property - Return the number of visible options in a drop-down list:
<!DOCTYPE html> <html> <body> <select id="mySelect" size="1"> <option>Cat</option> <option>Dog</option> <option>Horse</option> <option>A</option> <option>B</option> <option>C</option> <option>D</option> </select>// w w w. j a v a2 s . co m <button onclick="myFunction()">Test</button> <script> function myFunction() { document.getElementById("mySelect").size = "4"; } </script> </body> </html>