What’s the difference between
$data.find('select:selected');
and
$data.find('select').find(':selected');
?
Assume $data = $('#data') ;
<div id="data">
<div>
<select multiple>
<option value="foo">foo</option>
</select>
</div>
</div>
is basically the same as
Notice the descendant selector (the space between
selectand:selected). This finds any:selectedelement that’s within theselectelement.Your first selector, on the other hand, finds
select:selected, which doesn’t work because:selectedapplies tooptionelements only.