mardi 22 septembre 2015

Smooth transition after submission

When the submission is successful, meaning, there are no error messages that are generated, the form just disappears, kind of like thin air. However, I would like it to be a little smoother. I've tried fadeToggle() here and there but it didn't produce the effect that I wanted. Anybody have a solution to this problem?

This is the code that I have so far.

$(document).ready(function(){
    $("#validationForm").submit(function(event) {
        var errorMessage="";
        if(!isValidEmailAddress($("#emailAddress").val())) {
            event.preventDefault(); 
            errorMessage = errorMessage+"<br />Invalid Email Address";
        }
        $("#error").html(errorMessage); //I tried putting the fadeToggle() here.
    });
});
<form id="validationForm">    
    <input id="emailAddress" name="email" placeholder="Email"/>
</form>




Aucun commentaire:

Enregistrer un commentaire