how do you iterate through just the current values of all selects, not the options?
i have tried variations of this:
$('select[name^="mydropdowns"] :selected').each(function() {
if ($(this).val() != 'Test') {
alert("Found.");
}
});
‘Test’ is the default selected value across a couple dropdown menus, yet this script never returns an alert. what am I doing wrong here?
Just iterate through selects
val()is appliable toinput/select/textareaelements and not tooptionelement.From jQuery doc: http://api.jquery.com/val/