faqts : Computers : Programming : Languages : JavaScript : Language Core : Arrays

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

24 of 33 people (73%) answered Yes
Recently 3 of 10 people (30%) answered Yes

Entry

How do I delete one Option in select box in IE ?

Jan 9th, 2002 21:48
Suban Asif, Guest, Suban Asif


Set the option which you want to delete to 'null'.For example, you 
have a form with name 'frmTest' and a Combo box as 'cboTest'.If you 
want third option of this selection box to be removed, then wirte 
following:
 <SCRIPT language="JavaScript">
  document.frmTest.cboTest.options[2] = null;
 </SCRIPT>
<FORM name="frmTest">
 <SELECT name="cboTest">
  <OPTION value="1">Option 1
  <OPTION value="2">Option 2
  <OPTION value="3">Option 3
  <OPTION value="4">Option 4
 </SELECT>
</FORM>