Solution for jQuery validator resetForm not working issue. Validator.resetForm() reset form input but error message not cleared.

If you are facing following issue with jQuery Validator plugin, then given single line solution in this page will helpful for you.

Case when validator resetForm not working

  1. Form open in page or modal.
  2. User enter wrong input.
  3. jQuery validator shows error on submit or blur.
  4. User click reset form button or close form modal and open again.
  5. Code Validator.resetForm() execute with button click or modal close.
  6. Code reset form inputs, but error messages or border near input not removed.

Why jQuery validator resetForm not clear errors

Validator resetForm() function reset form input value only. It not clears nearer html error message elements. Actually this error elements added by Validator, but it not clear in resetForm() call.

Solution for jQuery validator resetForm not working

For solution, you need to remove error elements by code, just after resetForm call. Following is solution code for it with detailed explanation.

$('#myform label.error').remove();


Your form Validator object. For example:
var validator = $( "#myform" ).validate();.

#myform label.error:

Selector for your specific form error which show in lable element. For example:
<label id="cname-error" class="error" for="cname">This field is required.</label>

Here, given solution code first reset form by default Validator plugin method and second line code remove error message element nearer to input.


  • #1 Above given selector label.error. If this code not work for your form, first check your error message element and class and update in code, if it’s different from above.
  • #2 If your form shows error by input error border and it not remove with resetForm(). You can find that error border class and remove that class. For example $('#myform input').removeClass('error-border');

Hope, you got your solution from given jQuery validator resetForm not working solution. If you are still facing same issue, you can add detailed comment in comment section. It will helpful to us for improve solution and other users to get better solution.