Select Page

How to count the number of options in a select box using JQuery

This can be done using the jQuery length property

You will use the following command to determine if there are any options within the select box.

var length = $('#selectBoxId > option').length;
console.log(length);

#selectBoxId should be replaced with the ID of your select box.

Leave a reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.