[英]adding a custom jquery.validation method results in Uncaught TypeError: Cannot read property 'call' of undefined
I am battling to get jquery.validation to work with a custom method. 我正在努力让jquery.validation与自定义方法一起使用。
I am trying this 我正在尝试
$.validator.addMethod("validateMe", function (value, element) {
alert("validate");
});
$( "#myTextBox" ).rules( "add", {
validateMe: true
});
I am using jquery.validate v1.12 but when trying to validate I get an error of 我正在使用jquery.validate v1.12,但是尝试验证时出现错误
Uncaught TypeError: Cannot read property 'call' of undefined
Am I missing something here? 我在这里想念什么吗?
If anyone else has the same problem it turns out I wasnt providing a message 如果其他人有同样的问题,结果我没有提供任何信息
$.validator.addMethod("validateMe", function (value, element) {
alert("validate");
}, 'Hello message!');
did the trick 做到了
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.