I have a JavaScript method that i want to validate a form
if the validation fails so
if (validationChecks ...... ){
    return alert("message")
}
else{
//proceed
}
however no matter what i do in the if the form still seems to submit, any ideas?
you should return false after checking validation.
if (validationChecks ...... ){ 
     alert("message") 
    return false; } 
else{ 
//procced 
} 
                        You have spelt 'return' wrong. Also, returning an alert will not work, you'll need to return false explicitly to stop the form submitting.
if (validationChecks ...... ){ 
    alert("message");
    return false; 
} 
else{ 
//procced 
} 
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With