Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <body> <form> Select your favorite browser: <select id="myList" onchange="myFunction()"> <option></option> <option>Google Chrome</option> <option>Firefox</option> <option>Internet Explorer</option> <option>Safari</option> <option>Opera</option> </select> <p>Your favorite browser is: <input type="text" id="demo" size="20"></p> </form> <script> function myFunction() { var mylist = document.getElementById("myList"); document.getElementById("demo").value = mylist.options[mylist.selectedIndex].text; } </script> </body> <!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_text_value_dropdown by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:33:56 GMT --> </html>
Result:
Try it Yourself - © w3schools.com