Reputation: 13529
Is it possible using jQuery to verify if the following HTML select list contains any items?
HTML Select List of Countries which will initially be empty and may remain so unless populated.
<select size="5" name="Country" multiple="multiple" id="Country">
</select>
Upvotes: 0
Views: 257
Reputation: 6887
if (0 == $('#Country option').length) {
// no options
} else {
// options!
}
Upvotes: 0
Reputation: 19368
This will return true when there are items in the select.
alert($("#Country").children().length > 0);
Upvotes: 2