I have multiple select-elements like this:
<li>
<select>
<option>select something</option>
<option value="1">something</option>
<option value="2">anything</option>
</select>
</li>
<li>
<select>
<option>select something</option>
<option value="1">something</option>
</select>
</li>
<li>
<select>
<option>select something</option>
<option value="1">something</option>
</select>
</li>
Now I need to change the opacity to 0.5 for every select element which has a selected option after the page has loaded. I'm not quite sure if this can be done by pure CSS, so I tried to do that with JQuery:
$('select').each(function(select) {
$('select option').each(function() {
if($(this).is(':selected')) {
select.css({ opacity: 0.5 });
}
});
});
But this is not correct as it doesn't work.