Remove two option
<button>remove other than 1 and 3</button>
<br />
<select id="sel">
<option data-test="1">a</option>
<option data-test="1">b</option>
<option data-test="2">c</option>
<option data-test="2">d</option>
<option data-test="3">e</option>
<option data-test="3">f</option>
<option data-test="3">g</option>
<option data-test="4">h</option>
<option data-test="5">i</option>
</select>
$('button').click(function(){
$('select option:not([data-test=1])').remove();
})
I would like remove all parameters which are other than 1 and 3. I can
remove only with 1. What i must add for :not with jQuery that remove all
option other than 1 and 3?
jsfiddle
No comments:
Post a Comment