Reading multiple selected items

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Claus Mygind
    Contributor
    • Mar 2008
    • 571

    Reading multiple selected items

    I want to loop through an options array of a multiple select list and identify each selected item. All the examples I can find seem to deal with only reading the first selected item. A simple loop example would be appreciated.
  • Claus Mygind
    Contributor
    • Mar 2008
    • 571

    #2
    Well I figured it out
    Code:
        var cNewVal = ""
        for(i=0;i<document.getElementById("rDEPT").options.length;i++)
        {
            if (document.getElementById("rDEPT").options[i].selected )
            {
                cNewVal += document.getElementById("rDEPT").options[i].value+"~"
            }
        }
    
        document.getElementById("REVIEWDEPT").value = cNewVal

    Comment

    Working...