$("form").submit(function (event) {
var email = "\w+[\w-\.]*\@\w+((-\w+)|(\w*))\.[a-z]{2,3}$";
if ($('#fn1').val() == "") {
alert("At least one participant required")
$('#fullname1').focus();
event.preventDefault();
return
}
if ($('#fn1').val() != "" && ($('#ag1').val() == "" || !emailpattern.test($('#em1').val()))) {
alert("Your email ID or age is not valid and is mandatory")
$('#em1').focus();
event.preventDefault();
return
}
if ($('#fn2').val() != "" && ($('#ag2').val() == "" || !emailpattern.test($('#em2').val()))) {
alert("Your email ID or age is not valid and is mandatory")
$('#em2').focus();
event.preventDefault();
return
}
if ($('#fn3').val() != "" && ($('#ag3').val() == "" || !emailpattern.test($('#em3').val()))) {
alert("Your email ID or age is not valid and is mandatory")
$('#em3').focus();
event.preventDefault();
return
}
if ($('#fn4').val() != "" && ($('#ag4').val() == "" || !emailpattern.test($('#em4').val()))) {
alert("Your email ID or age is not valid and is mandatory")
$('#em4').focus();
event.preventDefault();
return
}
if ($('#fn5').val() != "" && ($('#ag5').val() == "" || !emailpattern.test($('#em5').val()))) {
alert("Your email ID or age is not valid and is mandatory")
$('#em5').focus();
event.preventDefault();
return
}
if ($('#fn6').val() != "" && ($('#ag6').val() == "" || !emailpattern.test($('#em6').val()))) {
alert("Your email ID or age is not valid and is mandatory")
$('#em6').focus();
event.preventDefault();
return
}
if ($('#fn7').val() != "" && ($('#ag7').val() == "" || !emailpattern.test($('#em7').val()))) {
alert("Your email ID or age is not valid and is mandatory")
$('#em7').focus();
event.preventDefault();
return
}
if ($('#fn8').val() != "" && ($('#ag8').val() == "" || !emailpattern.test($('#em8').val()))) {
alert("Your email ID or age is not valid and is mandatory")
$('#em8').focus();
event.preventDefault();
return
}
if ($('#fn9').val() != "" && ($('#ag9').val() == "" || !emailpattern.test($('#em9').val()))) {
alert("Your email ID or age is not valid and is mandatory")
$('#em9').focus();
event.preventDefault();
return
}
if ($('#fn10').val() != "" && ($('#ag10').val() == "" || !emailpattern.test($('#em10').val()))) {
alert("Your email ID or age is not valid and is mandatory")
$('#em10').focus();
event.preventDefault();
return
}
});