Javascript examples for DOM HTML Element:Option
Check value from <option>
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*from w w w . ja va2s . c o m*/ var elements = document.getElementsByTagName('option'); for (i=0;i<elements.length;i++) { if(elements[i].value == '48') { elements[i].selected = true; } } } </script> </head> <body> <select> <option value="50">50 - State</option> <option value="48">48 - State</option> </select> </body> </html>