MontyBurns
Programmer
Hi,
I have some combos which are being dynamically added to the page (i.e. multiple dependent combos) and I never know how many might be on the page.
All is working fine, except I need to get the actual text of each selected option, for each combo that exists on the page. I'm almost there - I just can't seem to figure out the correct syntax to retrieve the text. I can get the value attribute no probs like below:
var combos = document.getElementsByTagName("select"
for(var counter=0; counter < combos.length;counter++)
{
alert(combos.item(counter).value);
}
If I try replacing .value with .text it simply alerts "undefined".
Any ideas anyone? Any pointers would be really appreciated.
Thanks,
Monty
I have some combos which are being dynamically added to the page (i.e. multiple dependent combos) and I never know how many might be on the page.
All is working fine, except I need to get the actual text of each selected option, for each combo that exists on the page. I'm almost there - I just can't seem to figure out the correct syntax to retrieve the text. I can get the value attribute no probs like below:
var combos = document.getElementsByTagName("select"
for(var counter=0; counter < combos.length;counter++)
{
alert(combos.item(counter).value);
}
If I try replacing .value with .text it simply alerts "undefined".
Any ideas anyone? Any pointers would be really appreciated.
Thanks,
Monty