After jquery validate the authentication fails verify that the correct information is still residual solution on the label

When using validate form validation will be first verified by, but the second is not verified by the first verification of the information remains in the label above, the most common is the residual √

As shown in this FIG: At this time, "Please enter the name" it is normally the case when the front × be. how to solve this problem?

Jquery.validate.js files need to be modified for the following reasons:

But after a successful verification secondary verification fails, enter the following code:

        showLabel: function( element, message ) {
            var place, group, errorID,
                error = this.errorsFor( element ),
                elementID = this.idOrName( element ),
                describedBy = $( element ).attr( "aria-describedby" );
            if ( error.length ) {
                // refresh error/success class
                error.removeClass( this.settings.validClass ).addClass( this.settings.errorClass );
                // replace message on existing label
                error.html( message );
            } else {
                // create error element
                error = $( "<" + this.settings.errorElement + ">" )
                    .attr( "id", elementID + "-error" )
                    .addClass( this.settings.errorClass )
                    .html( message || "" );

Which performs error.removeClass (this.settings.validClass) this code, we find validClass will find validClass: "valid", we generally will verify the success of the class name to "success", so we only need to validClass: "valid"

Read validClass: "success" can eliminate this problem

 

Guess you like

Origin www.cnblogs.com/JSD1207ZX/p/11415615.html