1

我正在使用 jquery 表单验证来验证我的表单,但出现以下错误:

         Uncaught ReferenceError: jQuery is not defined jquery.validate.js:1178
Uncaught TypeError: undefined is not a function bootstrap.js:29
Uncaught ReferenceError: $ is not defined mimi.html:20

这是我的代码:

<!DOCTYPE HTML>
<html>
 <head>
    <link type = "text/css" rel="stylesheet" href="css/bootstrap.css" />

       <script type="text/javascript" src="http://jzaefferer.github.com/jquery-validation/jquery.validate.js"></script>
       <script src="js/bootstrap.js"> </script>
       <script> 
                 $(function(){ 
                                 $('form').validate()
                             }); 
        </script> 
 </head>
 <body> 
 <form class = "well span6"> 

 <label> Username </label> 
 <input type="text" id = "myName" class ="span3" placeholder ="Type your username here..." class = "required"/> 

  <label> Password</label> 
 <input type="text" id "myPassword" class ="span3" placeholder ="Type your password here..." class = "required"/> <br/> 

 <button id = "submit" class ="btn btn-primary">Submit </button>
 <button class = "" > Clear <br/></button><br/> 
 </form> 



 </body> 

</html>

我会很感激你的帮助。

4

1 回答 1

4

jQuery 验证需要 jQuery。jquery.validate.js您可以在脚本之前包含。

<script src="http://code.jquery.com/jquery-1.8.3.min.js" type="text/javascript"></script>
<script src="http://jzaefferer.github.com/jquery-validation/jquery.validate.js" type="text/javascript"></script>
于 2012-12-31T23:20:03.423 回答