Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firefox ignores option selected="selected"

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

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


In firefox, I've notice that the "selected" attribute will not work unless you place the select inside a form, where the form has a name attribute.


Just had the same issue, believe me it's been more than 10 hours struggling with this stupid firefox behavior, i have 7 dropdowns, each of them will trigger an event and fill in 24 hidden inputs, so you can imagine having the right option selected with 24 wrong input values!!! the solution i finally found is to reset the form with Javascript adding this line of code:

window.onload = function() { document.forms['MarkerForm'].reset(); };

PS: the inputs have the values pulled from a database, so resetting the form does not empty any value but in a way tells firefox to go back the hell to selected=selected option!


It's just Firefox remembering your previous selection when refreshing. Try a hard refresh instead.

Also, same issue over here: https://stackoverflow.com/a/1505693/1069232

Also see here: https://bugzilla.mozilla.org/show_bug.cgi?id=274795