ZVON > References > DOM2 Reference

remove (method )

Owning interface and usage:  
HTMLSelectElement.remove(index)

Member of these other interfaces:  
none

Description:  
Remove an element from the collection of OPTION elements for this SELECT. Does nothing if no element has the given index.

Parameters:  
long index  -  The index of the item to remove, starting from 0.

Returns:  
nothing

Exceptions:  
none


Example:
Source:
   <SELECT id="component-select">
      <OPTION value="Component_1_a" selected="selected">Component_1</OPTION>
      <OPTION value="Component_1_b">Component_2</OPTION>
      <OPTION value="Component_2_a">Component_3</OPTION>
      <OPTION value="Component_2_b">Component_4</OPTION>
   </SELECT>
JavaScript:
  function removeOption() {
    var main = document.getElementById('component-select');
    main.remove(1);
  }
Try it:  
See it: