Javascript: Validate Radio Buttons
Does anyone have a quick script to test if an option of a radio button has been selected?
-Adam
Web Development
Does anyone have a quick script to test if an option of a radio button has been selected?
-Adam
by richardh
Hi Adam
var checkBoxes = document.getElementsByTagName("input");
for(i=0; i
by joebevard
If the buttons are named the same you can siple think of them as an array. if this is the button:
you can reference them by this method:
if(document.all.btnAnswer[0].selected) { //"Y" is selected
}
else if(document.all.btnAnswer[1].selected) {
//"N" was selected
}
You're basically checking the selected property to see if it's value is true. Hope this helps!
This discussion is closed to new replies.
Sort by Trending