How can I display the value of a radio button in a form text box? I’d like it to change when the radio button is clicked.
Here is my radio buttons:
<input type="radio" name="testPassed" id="TestPassed" value="TestPassed">
<input type="radio" name="testFailed" id="TestFailed" value="TestFailed">
The text box:
<textarea name="description" cols="50" rows="5" id="description">Test Status: radioButtonValueHere </textarea>
Many thanks
Well, you can implement an
OnClickfunction with your radio button like this:<input type="radio" name="sports" value="Football" onClick="doSomething();">or you can have a function to iterate through all the radio buttons on your form and whichever is checked, will fill the textbox with your value: