$(“#form1").validate不是函数 [英] $("#form1").validate is not a function

查看:406
本文介绍了$(“#form1").validate不是函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<script type="text/javascript">
<!--
$(document).ready(function() { 
      $("#form1").validate({ 
        rules: { 
         budget: {
            required: true,
             minlength:3
        } ,
       duration: {
            required: true,
            digits:true
        }, 
         town: {
            required: true,
             minlength:2

        },

       content: {
            required: true,
            minlength:300 

        }
         }, 
        messages: { 


        } 
          }); 
        });
        -->
</script>

其中包含两个jquery文件.

Two jquery files are included.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="../common/jquery.validate.js"></script>

包括

.包含内容没有错.

are included. There is nothing wrong with the inclusion.

我收到一条错误消息

$(#form1").validate不是函数 怎么了?

$("#form1").validate is not a function What's wrong?

推荐答案

将jQuery脚本标签放在之前进行验证的脚本标签

我刚遇到这个极其令人沮丧的错误,并且由于缺乏在线可行的答案而在一个小时内损失了大部分时间.我在Firebug中确认,我正在同时使用jQuery和验证的CDN.

Put the jQuery script tag before the script tag for validation

I just encountered this extremely frustrating error and lost the better part of an hour to it, for lack of a workable answer online. I confirmed in Firebug that I was hitting the CDN for both jQuery and validation.

最后,更改此内容:

    <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.7/jquery.validate.min.js"></script>
    <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.4.4.min.js"></script>

对此:

    <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.4.4.min.js"></script>
    <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.7/jquery.validate.min.js"></script>

是我所需要的.

这篇关于$(“#form1").validate不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆