count number of value selected in multiselect dropdown jquery code example

Example 1: 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>

Example 2: jquery count selected options

var count = $("#mySelect :selected").length;