Hello! (Again)
So I have this jQuery Validation plugin, and it has a custom success message. The form validates automatically, because it's attached to the body. The problem comes when I wish to check the variable to see if the form is valid. That revalidates it, which ends up adding an extra success message (image in my case) which is undesired. I want the success message to only appear once, regardless of the fact it is validated multiple times. Here's my code:
$("#makeaComment").validate({
errorContainer: ".error",
errorPlacement: function(error, element) {
error.appendTo( element.next() );
},
success: function(label) {
label.removeClass("error").addClass("check");
}
});
$("#loginAction").click(function() {
if ($("#makeaComment").valid()) {
commentLogin();
}
else {
$('#loginAction').attr('value','Fix Errors and Continue');
}
});
Thanks!