<!DOCTYPE html>
<html>
<body>
<form>
<select id="mySelect" size="4">
<option>Apple</option>
<option>Orange</option>
<option>Pineapple</option>
<option>Banana</option>
</select>
</form>
<p>Click the button to display the number of options in the drop-down list.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("mySelect").options.length;
document.getElementById("demo").innerHTML = "Found " + x + " options in the list.";
}
</script>
</body>
</html>