[thelist] JavaScript value of text in an option element

Bill Haenel mail at webmarketingworx.com
Mon Jan 19 12:52:00 CST 2004


>From Devguru at
http://www.devguru.com/Technologies/ecmascript/quickref/option.html:

***********************
text Property
This property, by default tainted, reflects the text value following any
particular HTML OPTION tag for a Select object. It can be reset at any
time, immediately updating the display of the selection.
 
Syntax: object.text 
***********************

So to output the text of the selected option, you might do something
like:

document.write(document.formname.selectname[document.formname.selectname
.selectedIndex].text);

I'm pretty sure that would be correct usage.(?)

HTH,
BH


> Using JavaScript I need to validate against the contents of 
> the text in an <option> element 




More information about the thelist mailing list