0
0
WvWesley van Wyk
This code creates a function that takes an input of the name of a radio button, "myRadioButtons". The code then attempts to get an element by that name from the document. If the radio button is checked, the function increments the value of the element, otherwise it returns the text of the radio button.
function() {
var radioName = "myRadioButtons";
try {
var buttons = document.getElementsByName(radioName);
for (var i = 0;i < buttons.length;i++){
if(buttons[i].checked) {
return buttons[i].value;
}
}
} catch(e) {}
return "";
}