jQuery Validate plugin not working

点点圈 提交于 2020-01-06 03:36:05

问题


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. EDIT: solved, see below.


回答1:


I thought id put it as an answer in case people are wondering.

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.

From your comment above it seems this was due to using the wrong case on minlength attribute.



来源:https://stackoverflow.com/questions/11492264/jquery-validate-plugin-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!