0

script.js

$('#registerform').validate({
            errorElement: "div",
                    wrapper: "div",  // a wrapper around the error message
                    errorPlacement: function(error, element){
                    error.appendTo( element.parent().next() );
                    error.css('padding-left','30');
                    element.addClass('error-field');
            },
                    debug:true

        });

doubt

how am i suppose to remove the class error-field if the field is valid?

1 Answer 1

1

I don't use that plugin that much, but according to the doc, you simply add a success parameter:

$('#registerform').validate({
        errorElement: "div",
                wrapper: "div",  // a wrapper around the error message
                errorPlacement: function(error, element){
                error.appendTo( element.parent().next() );
                error.css('padding-left','30');
                element.addClass('error-field');
        },
                debug:true,
                success: function() {
                    element.removeClass('error-field');
                })

    });
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.