Hi,
I just saw the following:
http://www.w3schools.com/jsref/prop_option_value.asp
And wonder if there's something wrong with selectObject.value. Why not a simple approach:
It seems to be working with no problem.Code:<!DOCTYPE html> <html> <head> <script type="text/javascript"> function displayResult() { alert(document.getElementById("mySelect").value); } </script> </head> <body> <form> Select your favorite fruit: <select id="mySelect"> <option value="apple">Apple</option> <option value="orange">Orange</option> <option value="pineapple">Pineapple</option> <option value="banana">Banana</option> </select> </form> <button type="button" onclick="displayResult()">Display value of selected fruit</button> </body> </html>
Thanks in advance!
Mike


Reply With Quote
Bookmarks