I was just looking for something similar and found this:
$('.mySelect:not(:has(option[selected])) option[value="2"]').attr('selected', true);
This finds all select menus in the class that don't already have an option selected, and selects the default option ("2" in this case).
I tried using :selected
instead of [selected]
, but that didn't work because something is always selected, even if nothing has the attribute