jQuery validator - Cannot call method 'call' of undefined error - while adding validation dynamically

前端 未结 6 1665
失恋的感觉
失恋的感觉 2020-12-31 14:13

This is my code to update the jQuery validation dynamically. In document load i create the validation. This code is used to update the phone number validation dynamically. A

6条回答
  •  天命终不由人
    2020-12-31 14:17

    As a related bug, if you add a custom rule, using:

    $.validator.addMethod('field-is-valid', function (val, element) { ...})
    

    but then reference it in your rules declaration with the wrong name:

    $(element).rules('add', {
        "field-valid": true
    })
    

    you'll get the same Cannot call method call of undefined.

提交回复
热议问题