Firefox ignores option selected="selected"

monkey-wrench picture monkey-wrench · Jan 28, 2011 · Viewed 84.8k times · Source

If you change a dropdown and refresh the page, Firefox seems to ignore the selected attribute.

<option selected="selected" value="Test">Test</option>

It will in fact select the option you had previously selected (before the refresh). This ends up being a problem for me since there is an event triggered on the dropdown which changes other things.

Is there a way to make firefox stop this behavior (other than firing another event when the page loads)?

Answer

Marco Demaio picture Marco Demaio · Apr 10, 2012

Add autocomplete="off" HTML attribute to every select tag.

(source: https://stackoverflow.com/a/8258154/260080)