Javascript examples for DOM HTML Element:Select
Select value Property - Return the value of a selected option in a drop-down list:
<!DOCTYPE html> <html> <body> <form> Select your favorite fruit: <select id="mySelect"> <option value="a">Apple</option> <option value="orange">Orange</option> <option value="pineapple">Pineapple</option> <option value="banana">Banana</option> </select>/*from ww w. ja va 2 s . co m*/ </form> <button type="button" onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("mySelect").value; document.getElementById("demo").innerHTML = x; } </script> </body> </html>