javascript - How to print the value selected in a drop-down box in HTML using JS -


i designing web page goes this:

<html> <head> <title>bug ui</title> </head>  <body>  <script>     function myfunc()     {     //what goes here??     } </script> <form>     <select name = "parameters">         <option value = "param1">param 1</option>         <option value = "param2">param 2</option>         <option value = "param3">param 3</option>         <option value = "param4">param 4</option>         <option value = "param5">param 5</option>     </select>     <input type = "button" onclick = "myfunc()" value = "submit"> </form> </body> </html> 

it displays drop-down box, when select value (say param 1) box , click "submit", need print value (param 1 in case). how achieve this?

var s = document.getelementsbyname('parameters')[0]; var text = s.options[s.selectedindex].text; 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -