jQuery if select option equals value remove value on second select
how could i do: if in #myselect1 volvo is selected then remove 1st(740) and 2nd(940) option in #myselectVolvo
<select id="myselect1">
<opt开发者_运维问答ion 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>
$('#myselect1').change(function(){
if($(this).val() == 'volvo'){ // or this.value == 'volvo'
$('#myselectVolvo option:lt(2)').remove();
}
});
精彩评论