Perhaps you should use (or at least try)
<input type="radio">
to avoid all those ugly JavaScript errors.
Method 1
<label><input type="radio" name="Question" value="1">Option 1</label><br> <label><input type="radio" name="Question" value="2">Option 2</label><br> <label><input type="radio" name="Question" value="3">Option 3</label>
Using:
-webkit-appearance: none; -moz-appearance: none;
To clear the default all <input>
style so that you can apply the background, color, borders, or whatever you like there.
Method 2
<li><label><input type="radio" name="Question" value="1">Option 1</label></li> <li><label><input type="radio" name="Question" value="2">Option 2</label></li> <li><label><input type="radio" name="Question" value="3">Option 3</label></li> input[type=radio]{ width:0px; height:0px; }
Using this method, a switch will also be selected when you click on <li>
. Alternatively, you can create your own <li>
style too!
LIVE DEMO: http://jsfiddle.net/DerekL/CDV7q/ (with some additional changes)
source share