jQuery validation plugin error: TypeError: validator is undefined

后端 未结 13 2385
无人及你
无人及你 2020-12-09 03:10

Here is html code for the form:

13条回答
  •  猫巷女王i
    2020-12-09 03:15

    This issue was occurring for me when calling validator.destroy() - the error was occurring within the staticRules method of the plugin. The cause turned out to be the associated form element (element.form) was detached from the DOM. I resolved it by checking the element was in the DOM before calling destroy, using the following method:

    document.contains(element)
    

    Hopefully this helps someone.

提交回复
热议问题