I have a element in HTML. This element represents a drop down list. I\'m trying to understand how to iterate through the options in the <
<
$.each($("#MySelect option"), function(){ alert($(this).text() + " - " + $(this).val()); });
If you don't want Jquery (and can use ES6)
for (const option of document.getElementById('mySelect')) { console.log(option); }