1

我只是想问一下我的问题。我收到此错误

Uncaught ReferenceError: jQuery is not defined jquery.validationEngine-en.js:192
Uncaught ReferenceError: jQuery is not defined 
Uncaught TypeError: Object [object Object] has no method 'validationEngine'

当我尝试使用 jquery 验证引擎插件验证我的表单时。我按照说明进行操作,但我不知道为什么会出现此错误。我还仔细检查了路径,它也在工作。这是我的示例代码:

<html>
    <head>
        <title>TEST</title>

        <script type='text/javascript' src='http://localhost/mycrud/./third_party/jquery-validation/js/languages/jquery.validationEngine-en.js'></script>
        <script type='text/javascript' src='http://localhost/mycrud/./third_party/jquery-validation/js/jquery.validationEngine.js'></script>
        <link rel='stylesheet' type='text/css' href='http://localhost/mycrud/./third_party/jquery-validation/css/validationEngine.jquery.css' />

        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

    </head>
    <body>

        <form id="formID" method="post" action="submit.action">
            <input value="someone@nowhere.com" class="validate[required,custom[email]]" type="text" name="email" id="email" />
        </form>

        <script type="text/javascript">
            $(document).ready(function(){
                $("#formID").validationEngine();
            });
        </script>

    </body>

</html>
4

1 回答 1

2

在加载脚本之前加载您jQuery library的顶部。validation

由于它具有依赖关系,jQuery library因此您不能使用$jQuery在定义它们之前先加载库。

以这种方式加载:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type='text/javascript' src='http://localhost/mycrud/./third_party/jquery-validation/js/languages/jquery.validationEngine-en.js'></script>
<script type='text/javascript' src='http://localhost/mycrud/./third_party/jquery-validation/js/jquery.validationEngine.js'></script>
<link rel='stylesheet' type='text/css' href='http://localhost/mycrud/./third_party/jquery-validation/css/validationEngine.jquery.css' />
于 2013-10-29T01:10:10.227 回答