Javascript examples for DOM HTML Element:Select
Select Item In List Using Tag and Value
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//from w w w . ja va 2 s . co 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>