<input checked=checked type="radio" name="colors" value="red" />Red
<input type="radio" name="colors" value="green" />Green
<input type="radio" name="colors" value="blue" />Blue
Given the above, I set the red button to be selected by default (so I give it the checked=checked
attribute. With this, if I ever call .checked
on that input element, it will always return true, even if another option is selected.
In plain javascript (no jQuery), how can you get the actual selected option?