Reputation: 589
$('#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
});
how am i suppose to remove the class error-field if the field is valid?
Upvotes: 0
Views: 205
Reputation: 1318
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');
})
});
Upvotes: 1