Javascript Reference
Categories: SELECT

javascript SELECT remove( )

@Aug. 5, 2009, 11:19 a.m.
remove( ) Firefox/Netscape/NN 6 IE 5 Chrome/Safari/DOM 1  

remove(positionIndex)

  

Deletes an option element from the current select element at the zero-based index position signified by the parameter value. In lieu of setting the select object's length property to zero, you can remove all existing options with a simple loop construction:

while (selectElemRef.length> 0) {
    selectElemRef.remove(0);
} 
 

At this point, you can populate the list with new options via the various approaches described in the add( ) method discussion and the options object discussion.

 
Parameters
 
positionIndex

Zero-based integer signifying the item from the nested options collection to be deleted.

 
Returned Value

None.

That's all I've been looking for !
Kurt - 2010-05-07

Powered by Linode.