Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make html have priority over firefox's memory for select elements?

Tags:

html

firefox

Consider the following piece of code :

<select>
    <option value="0">foo</option>
    <option value="1" selected="selected">bar</option>
</select>

If I select the first option and reload the page, the first option stays selected and the select does not switch to the second option. How can I force firefox to give priority to the html?

like image 615
greg0ire Avatar asked Jun 09 '10 11:06

greg0ire


2 Answers

Good question. I think this can't be done using pure HTML.

You could try using JavaScript to reset the form. I don't know what it will reset to, but I guess it will do what you want:

 document.forms["formname"].reset();

needs to be triggered on the load event of course (or in ready() in jQuery).

like image 146
Pekka Avatar answered Sep 28 '22 08:09

Pekka


Select the second option using Javascript on page load.

like image 20
luvieere Avatar answered Sep 28 '22 06:09

luvieere