javascript - Dropdown holds its selection after page refresh -
i want dropdown list return first value after page refresh.
<!doctype html> <html> <head></head> <body> <div> <li><label>type2</label> <select id="sss"> <option selected id="one1">one</option> <option id="two2">two</option> </select><br></li> </div> <script> document.getelementbyid('sss').selectedindex=0 </script> </body> </html>
it works in firefox not in ie10. can please help?
solved it! had force script run after page loaded.
<!doctype html> <html> <head> <script> function loaded() {document.getelementbyid('sss').selectedindex=0;} </script> </head> <body onload="loaded()"> <div> <li><label>type2</label> <select id="sss"> <option id="one1" selected>one</option> <option id="two2">two</option> </select><br></li> </div> </body> </html>
Comments
Post a Comment