document.getElementById('').length = 0 doesn't work under Win7

Posted by Syom on Stack Overflow See other posts from Stack Overflow or by Syom
Published on 2010-05-18T16:14:13Z Indexed on 2010/05/18 17:01 UTC
Read the original article Hit count: 582

Filed under:
|
|

I have a select list:

<select id="sel">
     <option>text1</option>
     <option>text2</option>
     <option>text3</option>
     <option>text4</option>
</select>

I want to delete all items, without for loop. I tried:

document.getElementById('sel').length = 0;

But this doesn't work in some browsers.
Any ideas?

Thanks

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about collections