<select id="select1">
<option value="11">11</option>
<option value="12">12</option>
</select>
<select id="select2">
<option value="21">21</option>
<option value="22">22</option>
</select>
find()
およびchildren()
メソッドの動作:
find()
:
$('#select1, #select2').find('option:not(:first)').remove();
期待どおりに機能:select1
オプションのみが11
ありselect2
、オプションのみがあります21
children()
:
$('#select1, #select2').children('option:not(:first)').remove();
奇妙に動作します:select1
オプションしかありません11
がselect2
、もうオプションはありません...
なんで?