I have a form where I ask for an email that I validate trought a regular expression, if the email is correct, I do a submit, if not I send an alert.
When I put an invalid email the alert is shown, but if I put a valid email the alert is shown and then the submit() is done, I don't even know how is this posible! Here is my code.
$('#sinCopago').on('click', function(event){
    if($('#nombreContratante').val() != "" && $('#motivo').val() != ""){
        if($('#fechaNac').val() > hoy){
            alert("Ingresa una fecha de nacimiento válida.");
        }else{
            if(validarMail($("#correo")) == true){
                event.preventDefault();
                $('#progressBarSisnova').modal({show:true});
                $('#payment-form-Sisnova').submit();
            }
            else{
                alert("Ingresa un correo válido");
            }
        }
    }
    else{
        alert("Por favor llene todos los campos");
    }
});
function validarMail(email){
    var caract = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
    if(caract.test(email) == false){
        return false;
    }
    else{
        return true;
    }
}
 
     
    