我只是想问一下我的问题。 我收到此错误
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>
答案 0 :(得分: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' />