How do I clear all options in a dropdown box?

My code works in IE but breaks in Safari, Firefox, and Opera. (big surprise)

document.getElementById("DropList").options.length=0;

After searching, I’ve learned that it’s the length=0 that it doesn’t like.
I’ve tried ...options=null and var clear=0; ...length=clear with the same result.

I am doing this to multiple objects at a time, so I am looking for some lightweight JS code.

27 Answers
27

Leave a Comment