...

View Full Version : Select label



mares
10-01-2002, 06:23 PM
Hi,

I would like to use the label of the selected option in select object?

If i use "optionName.innerText":
<select name="optionName" onchange="alert(optionName.innerText)">
<option value="1" SELECTED>Option 1</option>
<option value="2">Option 2</option>
</select>

The alert returns "Option 1 Option 2".

But i need only the label of the selected item (ie "Option 1").

Thank you!

mares

adios
10-01-2002, 06:58 PM
<select name="optionName" onchange="alert(options[selectedIndex].text)">
<option value="1" SELECTED>Option 1</option>
<option value="2">Option 2</option>
</select>

Not really a 'label', mares....;)

mares
10-01-2002, 07:59 PM
Thank you!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum