Mega Code Archive

 
Categories / JavaScript DHTML / Form Control
 

Number of options in the dropdown list(Combobox)

<html> <head> <script type="text/javascript"> function formAction(){     var x=document.getElementById("mySelect")     alert(x.length) } </script> </head> <body> <form> <select id="mySelect">   <option>1</option>   <option>2</option>   <option>3</option> </select> <input type="button" onclick="formAction()" value="How many options in the list?"> </form> </body> </html>