Click to See Complete Forum and Search --> : Retrieving all option values from listbox


SpeedStick
12-19-2006, 06:11 PM
Hi,

I'm working with a javascript function that allows you to move options back and forth between listboxes. This is working fine - however, when the form is submitted, I want to retrieve all the option values from one of the listboxes to see which values have been removed. Is there any way to retrieve the options of a listbox whether they are selected or not? Thanks....

Kudose
12-20-2006, 08:49 PM
Is there any way to retrieve the options of a listbox whether they are selected or not?

var listBox = document.getElementById('listboxID');
for(var i = 0; i < listBox.options.length; i++){
if(listBox.options[i].selected == true){
//do stuff
}
}


pretty sure it goes something like that ...