Clearing a listbox

Results 1 to 2 of 2

Thread: Clearing a listbox

  1. #1
    Join Date
    Dec 1969

    Default Clearing a listbox

    Can someone tell me how to clear a select list?<BR>Box A populates Box B. But when previous choices of Box B<BR>are longer than current choices of BoxB, they remain in the<BR>box.<BR><BR>I was using this code to do it but that was when I hade repeating<BR>rows on the same listbox.<BR>for(i=1;i&#060; lue-1;i++)<BR>{<BR>eval("document.forms[" + "&#039frm&#039" + "].elements[" + "&#039model" + rowCount + "&#039].options.length = 0")<BR>}<BR><BR>But now I have only 1. <BR><BR>I thought this would do it<BR>document.forms.frm.elements.model1.options.l ength = 0<BR><BR>But it does not.<BR><BR>Thanks,<BR><BR>Ken

  2. #2
    Join Date
    Dec 1969

    Default RE: Clearing a listbox

    I think this should work<BR>document.yourformname.selectlistname.optio ns.length=0<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts