为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

情有独钟 2015-04-11 16:44:09
<!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>这段代码哪里错了,为什么不进行验证就提交了呢
查看完整描述

1 回答

?
狗要绿豆冰

TA贡献1条经验 获得超0个赞

<script type="text/javascript" src="/office/js/jquery。validate.js"></script>你确定你这个是这样命名的?

查看完整回答
反对 回复 2015-04-13
  • 1 回答
  • 0 关注
  • 1344 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信