Firefox Radio button issue – Selects the next option on refresh

This is something I encountered in my last job, don’t know if it still happens

But in case anyone encounters the same problem. Here is the gist of it

Suppose a page has a radio button with three options like so

(#) Option 1
( ) Option 2
( ) Option 3

Selection will change on every refresh, suppose we pressed F5 to refresh the page, it will now look like this

( ) Option 1
(#) Option 2
( )  Option 3

This behaviour is only present on firefox, supposedly it has been a problem since 2007 but noone bothered to fix it: Bugzilla link

The “fix” is simple

Turn off autocomplete feature


<form autocomplete="off">

Or through jQuery



$(document).ready(function() {
 if($.browser.mozilla) $("form").attr("autocomplete", "off"); 
 }); 
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s