How do I obtain the value of Select?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • html

    #1

    How do I obtain the value of Select?

    I have a select tag as follows

    <SELECT ID="Select1" NAME="Select1" ONCHANGE="do_al ert()">
    <OPTION>1</OPTION>
    <OPTION>2</OPTION>
    </SELECT>

    I need, when the user choose an option, to print an alert
    which displays the text in the option chosen, i.e. 1 or 2
    in this example, but how do I access the value of the html
    select tag, I tried

    alert(document. getElementById( 'Select1').valu e);

    But this seems to be an empty alert box. Any ideas what might I be
    doing wrong?

    Tia



Working...