View Full Version : How can I clear a Select listbox that was populated dynamically?

06-16-2007, 05:14 PM
I use the following code but it didn't work:<br>

var selectList = document.getElementById("mylist");
for (i=0;i<selectList.options.length;i++)

Please help.

06-16-2007, 06:04 PM
Simply setting the options length to zero will delete all the items.

selectList.options.length = 0;

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum