I just tried the following HTML :
<input type='radio' checked='checked' name='test' id='r1' />
<input type='radio' checked='' name='test' id='r2' />
which (in my mind's eye) should have the first radio button checked. Turns out browsers will check any radio button with a checked
attribute.
Is there a 'false' value, that won't check the button, so my code is consistent?
The absence of the checked attribute is the only way you can do this.
Traditionally only the word checked was requried to indicate a checked status (you didn't have to set it to be a value). I think the attributename="value" pattern is for compatibility with standards such as xhtml (which is why browsers ignore the value itself)
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