Can you assist me in resolving an issue? I am struggling with removing an error message once a user has corrected their mistake, particularly when it comes to validating an email field. The error keeps getting added multiple times until validation is successful. Here is the code snippet:
$( "#bookings" ).validate({
rules: {
email: {
required: true,
email: true
},
message: {
email: {
required: "field is required",
email: "invalid email"
},
errorLabelContainer: $("ul", $('div#results')), wrapper: 'li',
errorContainer: $('div#results'),
errorPlacement: function(error, element) {
$('#results').append(error);
}
success: function(error){
error.remove();
}
});
<div id="results">
</div>
<form name="bookings" id="bookings" method="post" action="#">
<div class="item" style="clear:left;">
<label>E Mail *</label>
<input id="femail" name="email" type="text">
</div>
</form>
I want the error message to appear only once. I have succeeded in removing the error, but it still gets appended repeatedly until the validation is accepted.