How to reset (back to 0 index) dropdown list on 'back' button of browser using Javascript?
You can use the 'onbeforeunload' event:
<script>
function reset_options() {
document.getElementById('MySelect').options.length = 0;
return true;
}
</script>
<body onbeforeunload='reset_options()'>
...
yes its easy.
i have a dropbox and its id was "stroke_style" the reset is just to set it at -1 index (before 0)
document.getElementById("stroke_style").selectedIndex = -1;
example: http://languagelassi.blogspot.in/search/label/Dropdown%20Reset%20Javascript
and you can put it in a method or directly <body onload="">
of that page
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With