Connecting Tech Pros Worldwide Help | Site Map

How do I obtain the value of Select?

  #1  
Old September 26th, 2008, 07:25 PM
html
Guest
 
Posts: n/a
I have a select tag as follows

<SELECT ID="Select1" NAME="Select1" ONCHANGE="do_alert()">
<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').value);

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

Tia



Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I obtain the value of Select? html answers 3 September 26th, 2008 11:35 PM
Remove sibling elements according to the value of an attribute patrizio.trinchini@googlemail.com answers 3 August 23rd, 2006 08:15 AM
Change the value of an attribute according to the value of another attribute patrizio.trinchini@googlemail.com answers 8 August 22nd, 2006 03:45 PM
Obtain boolean value of expression in PLPGSQL Max Speransky answers 3 November 12th, 2005 12:31 AM