I have select
with two optgroup
. I want in JS to delete all% with% that are only in options
.
<select id = "testSelect" name="testSelect">
<optgroup label="opt1">
<option value="3">Apples</option>
<option value="1">Oranges</option>
<option value="2">Pears</option>
</optgroup>
<optgroup label="opt2">
<option value="4">ford</option>
<option value="6">toyota</option>
<option value="5">ferrari</option>
</optgroup>
</select>
In this example I want to delete the optgroup
from options
2. Something like this:
$$("input[type=select][id=^testSelect][label="opt2"]").each(function(curr){
//get outgroup
//remove all options;
}