• Monday, January 19th, 2009
To remove all options from a dropdown select box with JavaScript, simply set the length property of the dropdown box to 0. For instance, if a dropdown select box is defined as follows:
<select name=’dropdown’ id=’id_dropdown’>
<option value=’1′>1</option>
<option value=’2′>2</option>
</select>
Use this JavaScript to remove all the options in the dropdown select box.
document.getElementById(’id_dropdown’).length = 0;
Category: Tech
| | Leave a Comment