Use Following code to Validate radio button on your form:
function checkRadio (frmName, rbGroupName) {
var radios = document[frmName].elements[rbGroupName];
for (var i=0; i if (radios[i].checked) {
return true;
}
}
return false;
}
To call this function for validation use the following code:-
------------------
if (!checkRadio("frm1","rdbgender"))
alert("You didnt select any fruits");
else
alert("You selected a fruit");
Comments