Answers for "get select option count using jquery"

0

get select option count using jquery

$(document).ready(function(){
   console.log($('#input1 option').size());
   console.log($('#input1 option').length);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<select data-attr="dropdown" id="input1">
   <option value="Male" id="Male">Male</option>
   <option value="Female" id="Female">Female</option>
</select>
Posted by: Guest on October-27-2020
0

jquery count selected options

var count = $("#mySelect :selected").length;
Posted by: Guest on June-26-2020

Code answers related to "get select option count using jquery"

Code answers related to "Javascript"

Browse Popular Code Answers by Language