I have 3 radio buttons : Red, Blue and green
When I select one of the three radio buttons, a popup box (alert) should appear and should display the text of the selected radio button (example : Blue). Can anyone please provide the javascript code for the it.
Thank You
Sorry about that, Here’s what I tried regarding the javascript code:
function radioEvent (radio)
{
var dom = document.getElementById("myForm");
for (var index = 0; index < dom.radioButton.length;index++)
{
if (dom.radioButton[index].checked)
{
radio = dom.radioButton[index].value;
}
}
}
<td rowspan = "2" >
<input type="radio" name= "radioButton" value= "radio1"> Excellent<br>
<input type="radio" name="radioButton" value="radio2" > Very Good <br>
<input type="radio" name="radioButton" value="radio3" > Good <br>
<input type="radio" name="radioButton" value="radio4" > Satisfactory
</td>
My question is What to do next? I am confused…
1 Answer