Phoebe_Yi
asked on
Delete an option from Combo box
May I know how to delete an option from combo box? for e.g, in my combo box there are 5 options:
red
blue
black
yellow
white
if user click an radio button, I need to remove black from the combo box, may I know how to do tt?
red
blue
black
yellow
white
if user click an radio button, I need to remove black from the combo box, may I know how to do tt?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
<form>
<select>
<option>red
<option>blue
<option>green
<option>black
</select>
<input type=radio name=clrs onclick="remove(0);">Red
<input type=radio name=clrs onclick="remove(1);">Blue
<input type=radio name=clrs onclick="remove(2);">Green
<input type=radio name=clrs onclick="remove(3);">Black
</form>
<script>
function remove(n){
var sel=document.forms[0].elem
sel.options[n]=null;
}
</script>