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

10 sec read

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.

Last Updated On March 21, 2018

Leave a Reply

avatar
  Subscribe  
Notify of