Home
| Colors: |
March 2026

Prevent a Checkbox from Staying Checked when a Page Refreshes in Firefox

This one bit me.

In some browsers, a checkbox that's been checked will revert to unchecked by default if the pages refreshes. That's not true in the current version of Firefox. You have to add autocomplete="off" to make it consistent with the other browsers.

For example, in my Chrome browser I can check both of these and when I refresh the page both revert to being unchecked. In Firefox, the first box stays checked.

Output

HTML

<div>
  <label>
    <input type="checkbox" />
    Example checkbox without an autocomplete attribute 
  </label>
</div>

<div>
  <label>
    <input type="checkbox" autocomplete="off" />
    Example checkbox with autocomplete set to 'off'
  </label>
</div>

We have way fewer differences between browsers than in the days of The Browser Wars. They still crop up from time to time, though.

-a

end of line

Endnotes

I'm running Firefox on a mac and seeing the checkbox state persist there. YMMV on other OSes and maybe the browsers will gain consistency over time.

The input -> autocomplete docs on MDN state that:

This attribute has no effect on input types that do not return numeric or text data, being valid for all input types except checkbox, radio, file, or any of the button types

Clearly, that's not accurate. The checkbox -> checked docs have an explicit call out to Firefox maintaining the state and pointing to autocomplete for how to address it.

References