This looks like a really basic question and I've created dozens of forms, but I just can't see what the problem is here.
I have these two radio buttons:
<input type='radio' class='free atype' value='0' name='dutch' checked='checked'/> Free<br/>
<input type='radio' class='paid atype' value='1' name='dutch' /> Paid
Obviously the first one should be checked by default.
However, when I check the second one and then refresh the page, the second radio remains checked. I know this is wrong behavior, but I can't for the life of me see what I'm doing wrong.
I'm trying this on Firefox.
Give people control and align with their expectations (Good): It is better to have a selected radio button by default, given that people cannot deselect and set the button back to its original state once one has been selected. A default selection sets the correct user expectation.
You cannot unselect radio buttons. That's because they're used if you want the user to select either option1 or option2 or option3 but prohibit selecting multiple values or leaving it empty (e.g. in case of selecting a Gender).
This is what's called auto complete, you can try to turn it off by adding the autocomplete="off"
property to your inputs
<input type='radio' class='free atype' value='0' name='dutch' checked='checked' autocomplete="off"/> Free<br/>
<input type='radio' class='paid atype' value='1' name='dutch' autocomplete="off"/> Paid
You can also put it on the <form>
the elements are in.
Use Autocomplete="Off" as one of the properties in a tag
that will make some sense for that code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With