DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Remove Option Elements From A Select Element Using JavaScript
Pretty simple, but here it is anyway.
// The DOM way.
var sel = document.getElementById('id_of_select');
for (i = sel.length - 1; i >= 0; i--) {
sel.remove(i);
}
// The following code removes all options from a select element, but it only works
// in Firefox, IE and Opera. It does not work in Chrome or Safari.
sel.length = 0;





