change value of radio button
chuckles
Status: New User - Welcome
Joined: 19 Sep 2005
Posts: 1
Reply Quote
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
rkoenig
Status: Interested
Joined: 04 Oct 2003
Posts: 16
Reply Quote
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.
Back to top
Display posts from previous:   

All times are GMT - 8 Hours