I have a select box, and when someone hits the back button, I’d like the first option to be selected again. It works fine in Chrome and such, but not IE 8. Here’s my code:
<select id="select-city">
<option selected="selected">Choose city</option>
<option value="Acton-Vale">Acton Vale</option>
<option value="Alma">Alma</option>
<option value="Amos">Amos</option>
</select>
<script type="text/javascript">
$('#select-city')[0].selectedIndex = 0;
</script>
Any ideas?
Try putting your JavaScript in a document ready block