求教关于validate插件表单验证的问题。


<!DOCTYPE html>
<html>
<head>
<meta charset="GBK">
<title>登录</title>
<script type="text/javascript" src="/office/js/jquery-1.9.1.js"></script>
<script type="text/javascript" src="/office/js/jquery。validate.js"></script>
<script type="text/javascript">
$(document).ready(function(){
 $("#login").validate({
  //自定义验证规则
          rules:{
             userName:{required:true},
          password:{required:true}
              },
          //自定义提示信息
         /* messages:{
             userName:{required:"请输入你的用户名"},
              password:{required:"请输入密码"}
             }, */
          //定义错误信息提示位置
         errorPlacement:function(error,element){
             error.appendTo(".tip");
            // error.appendTo(element.parent());

         }
  });
});
</script>
</head>
<body>
  <div style="width:400px;height:250px;margin:15% auto;background:#e8f4ff;">
  <div style="winth:100%;height:15%;"></div>
<form id="login" name="login" method="post" action="login.php">
<table style="width:100%;height:200px">
<tr >
<td align="right">用户名:</td>
<td><input name="userName" type="text" id="userName" onmouseover="this.style.backgroundColor='#ffffff'" onMouseOut="this.style.backgroundColor='#e8f4ff'" size="15" /></td>
</tr>
<tr>
<td align="right">密码:</td>
<td><input name="password" type="password" id="password"  onmouseover="this.style.backgroundColor='#ffffff'" onMouseOut="this.style.backgroundColor='#e8f4ff'" size="15" /></td>
</tr>
<tr>
<td></td>
<td><span class="tip"></span></td>
</tr><tr>
<td></td>
<td><input type="submit" value="登录"  name="submit" />&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" value="重置" name="reset" /></td>
</tr>
</table>
  </form>
  </div>
  </body>

这段代码哪里错了,为什么不进行验证就提交了呢

情有独钟
浏览 1345回答 1
1回答

狗要绿豆冰

<script type="text/javascript" src="/office/js/jquery。validate.js"></script>你确定你这个是这样命名的?
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JQuery