How to clear jquery validate errors

后端 未结 6 1032
灰色年华
灰色年华 2020-12-14 10:26

I\'m hijaxing an existing form and POSTing to the server. jQuery validate does most of the validation but if validation fails on the server we return the errors to the clien

6条回答
  •  [愿得一人]
    2020-12-14 11:09

    May be I am wrong to clear the errors like this:

    function clearError(form) {
        $(form + ' .validation-summary-errors').each(function () {
            $(this).html("
    "); }) $(form + ' .validation-summary-errors').addClass('validation-summary-valid'); $(form + ' .validation-summary-errors').removeClass('validation-summary-errors'); $(form).removeData("validator"); $(form).removeData("unobtrusiveValidation"); $.validator.unobtrusive.parse($(form)); };

    I tried answer given in the comment by AaronLS but not got the solution so I just do it like this.

    Maybe helpful to someone.

提交回复
热议问题