我该怎么做:如果在#myselect1 volvo中选中,则删除#myselectVolvo中的1st(740)和2nd(940)选项
<select id="myselect1">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
<select id="myselectVolvo">
<option value="740">740</option>
<option value="940">940</option>
<option value="240">240</option>
<option value="340">340</option>
</select>
答案 0 :(得分:45)
$('#myselect1').change(function(){
if($(this).val() == 'volvo'){ // or this.value == 'volvo'
$('#myselectVolvo option:lt(2)').remove();
}
});