Javascript examples for DOM HTML Element:Option
Change select option with var change
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <select id="select1" onchange="jsFunction(this)"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select> <script> document.getElementById('select1').value = 2; function jsFunction(select){ console.log(select.value); } </script> </body>//from w w w .j a va2 s . c om </html>