How can I validate radio buttons? Because this won't work at all. The radio button name
and ID
is billable
and their value
is either yes
or no
.
function formValidator() {
var errors = new Array();
if($("#billable").checked == false) {
errors[0] = "*Billable - Required";
}
if(errors.length > 0) {
var error_msg = 'Please review:';
for(i=0;i<errors.length;i++) {
if(errors[i]!=undefined) {
error_msg = error_msg + "\n" + errors[i];
}
}
alert(error_msg);
return false;
}
return true;
}