Consider below, select
<select id="phone_line" name="phone_line"> <option value=""></option> <option value="BB-11">Line 1</option> <option value="AA-22">Line 2</option> <option value="AA-33">Line 3</option> <option value="BB-44">Line 4</option> </select>
If I want to filter the parameters and delete the row with the value BB-44 , I can do it like:
$('#phone_line option').filter(' option[value="BB-44"] ').remove();
If I want to delete lines, which values are triggered using AA ? I can do this with each, as shown below:
$("#phone_line > option").each(function () { if (this.value.substring(0, 2) === 'AA') { $("#phone_line option[value='" + this.value +"']").remove(); } });
But can I do this with filters (on the same line ?!). Code:
http://jsfiddle.net/mpp4emd1/
source share