I have an html select element that I have in a webapp built in Google Apps Scripts. The basic html renders and then asynchronously I add the long list of select items using jQuery and Javascript.
I want to iterate through all of the select options but cannot read more than the original select item that initially renders. In other words, even though I can see my 1300 options on the webpage, the length of the select comes back as one and therefore I cannot iterate.
Here is my initial html:
<select class ="selectNames" id = "studentNameSelect"><option value = "none" selected>Pick your name</option></select>
I then make an html string and add the additional options:
$("#studentNameSelect").append(payload[0]);
This works great for me up to here.
Now when I try to read the length of $("#studentNameSelect") even though I see a long list, length comes as 1.
alert($("#studentNameSelect").length);
What am I missing
$("#studentNameSelect option").length