Quickie. Empty select.
Posted November 5, 2009
on:Some ie6 bug prevent from properly clearing the options of a select html element. This is an issue the actual length that myselect.options.length statement returns. The smart way to do this is with a while loop.
function removeSelects(elementId){
var myselect = document.getElementById(elementId);
for(var i=0; i<myselect.options.length; i++){
myselect.options[i] = null;
}
while (myselect.options.length > 0) {
myselect.options[0] = null;
}
}

2 Responses to "Quickie. Empty select."

Good to know. I need help with this too! You will be surprised how easy it can be to fill forms. Try fillingl a form through the online sowtware http://goo.gl/xmhZ38.

September 19, 2011 at 9:33 pm