| Back to top |
How do I change the value of a radio button?
I want to change the selection based on an event. Let's say clicking another button. |
|||||
| Back to top |
That's pretty easy, here's a simple version:
:: Code :: <form name="theForm" action="radio-switch.htm" method="post">
<input type="radio" name="test"> <input type="radio" name="test"> <input type="radio" name="test"> </form> <a href="#" onclick="theForm.test[1].checked = true;">test</a> Works fine as you can see. Obviously you'd be changing the test.[1] value dynamically, that's just hard coded in for demonstration purposes. |
|||||
|
All times are GMT - 8 Hours
|
||||||