Reputation: 218732
How can i get the number of items(option) in a HTML select box in jQuery ?
Upvotes: 0
Views: 736
Reputation: 12368
$(function(){
var count =$('select#myID > option').size();
alert(count);
});
Upvotes: 1
Reputation: 630389
You can use .length
to see how many elements a selector matched, for example:
var count = $("#selectID option").length;
Upvotes: 5