jQuery - Counting Items if Drop Down

You can use the .length property to count the number of items in a Select object (drop down). You can actually use this on any javascript array - all jQuery does is target and find the ddl control.

 


let items = $("#Fruit option").length;
$("#demo1").html("There are " + items + " items in the drop down.");