Click to See Complete Forum and Search --> : multiple select


bluewater68
08-13-2003, 11:38 AM
I have a <select multiple>.
The goal is to retrieve the items that have been selected.
With the selectedIndex only retrieves the first item selected, not the others.
Is this possible to do?
Thanks to everyone that replyes this question.

AdamGundry
08-13-2003, 11:41 AM
You need to iterate through the options array, like this (from Netscape Devedge (http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/select.html#1193366)):
for (var i = 0; i < mySelect.options.length; i++) {
if (mySelect.options[i].selected)
document.write(" mySelect.options[i].text\n")
}Adam (the code thief)

Khalid Ali
08-13-2003, 11:53 AM
Originally posted by AdamGundry
[/code]Adam (the code thief)

LOL...I am guessing that you must have a huge libarary by now...I think its time for you to sell it all at e-bay....:D