Click to See Complete Forum and Search --> : printing option selected index


mili
08-02-2003, 01:10 PM
I have a select box like this

<select name="sel1" onchange="changeDIV(this)">
<option value="">select an item</option>
<OPTION value="1">records Check</OPTION>
</select>

I'm trying to print "records check"

I used this:
alert(document.forms[0].sel1.options[document.forms[0].sel1.selectedIndex].value);

and the result i got was 1.

How can I print the value between the option tag as opposed to value=1?

thanks

Fang
08-02-2003, 01:32 PM
Change value to text:

alert(document.forms[0].sel1.options[document.forms[0].sel1.selectedIndex].text);

mili
08-02-2003, 01:48 PM
Thanks :)