jQuery Validate插件不起作用 [英] jQuery Validate plugin not working
问题描述
这让我疯了。 jQuery验证插件似乎根本没有做任何事情。以下是代码: http://jsfiddle.net/pkyGf/
This is driving me nuts. The jQuery validation plugin doesn't seem to be doing anything at all. Here's the code: http://jsfiddle.net/pkyGf/
这是导致错误的验证码。
This is the validate code which is causing the error.
<script>
$(function(){
$('#purchase').validate({
rules:{
course:{
minLength:1
},
creditCard: {
required: true,
creditCard: true
},
expMonth: {
required: true,
min: 1,
max: 12,
digits: true
},
expYear: {
required: true,
min: 12,
max: 60,
digits: true
}
}
})
})
</script>
感谢任何可以提供帮助的人。
编辑:已解决,见下文。
Thanks to anyone who can help. solved, see below.
推荐答案
我认为id会把它作为答案以防人们想知道。
I thought id put it as an answer in case people are wondering.
实际输入任何输入时(即尝试验证时)会发生错误。此错误位于validate js文件的第29行。错误如下:未捕获TypeError:无法调用未定义的方法'call'
。
The error occurs when any input is actually entered (i.e. when it tries to validate). This error is on line 29 of validate js file. The error is as follows: Uncaught TypeError: Cannot call method 'call' of undefined
.
从上面的评论这似乎是由于在 minlength 属性上使用了错误的情况。
From your comment above it seems this was due to using the wrong case on minlength attribute.
这篇关于jQuery Validate插件不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!