i had this code:
$("#source_lang, #targ_lang").each(function(index, element) {
if ($(this +'option:selected').length== 0) {
//some code
}
}
I want to display error messages when none of items on the lists is selected.
This gives me no results(the error message doesn’t show).
or – without using the each – you could also check
(this means that at least one select has not been selected)