getting the <select> option value - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Option


getting the <select> option value

Demo Code

ResultView the demo in separate window

      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*from   w w  w . jav a  2s  .c  o  m*/
var select = document.getElementById('tdd');
if (select){

      <select id="tdd"> 
         <option val="1">Option 1</option> 
         <option val="2">Option 2</option> 
         <option val="3" selected>Option 3</option> 

Related Tutorials