How do i loop thru all dropdown boxes in JQuery?
Use the jQuery: selected selector in combination with val () method to find the selected option value in a drop-down list.
With jQuery, you can use the . val() method to get an array of the selected values on a multi-select dropdown list.
$('#mySelectBox option'). each(function() { if ($(this). isChecked()) alert('this option is selected'); else alert('this is not'); });
Answer: Use the jQuery :selected Selector You can use the jQuery :selected selector in combination with the val() method to find the selected option value in a select box or dropdown list.
something like this should do the trick
$("select").each(function() {
//do something with the select $(this) will give you the select element
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With