Validation Error Message won't hide when valid

后端 未结 2 757
情深已故
情深已故 2021-01-19 00:13

UPDATE 2: I figured out that the title of the input was for some reason being displayed as an error message, I used ignoreTitle: tru

相关标签:
2条回答
  • 2021-01-19 00:38

    just comment the errorplacement option and it will work as required.

    $(".guestlist-form").validate({
         ignoreTitle: true,
         errorClass: "error-class",
         validClass: "valid-class",  
    
         rules: {
            emailaddress: {
                required: true,
                email: "Please enter your correct email address."
            }
        },
        /*errorPlacement: function(error, element) {
            $(".myerror").html('');  // clears previous error messages
            error.appendTo( ".myerror");
        },*/
    
    
    
        messages: {
                     emailaddress: {
                     required: "Please enter your full email address."          
                    }
    
        }
    
    });
    

    Updated fiddle - http://jsfiddle.net/psbq8vkj/11/

    0 讨论(0)
  • 2021-01-19 00:40

    You have to add the success function to the validation :

    success: function(label,element) {
       $(".myerror").html('');
    },
    

    JSFiddle

    0 讨论(0)
提交回复
热议问题