首页 > 代码库 > jquery.validate小注

jquery.validate小注

jquery.validate 远程验证备注
1.message一定要写到最前面,这样提示信息才能显示自定义的提示;
2.validate.aspx页面返回值为true或false即可
1
<!DOCTYPE html"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <title>Validate Demo</title> 5 <script src="Scripts/jquery-1.10.1.min.js" type="text/javascript"></script> 6 <script src="Scripts/jquery.validate.js" type="text/javascript"></script> 7 </head> 8 <body> 9 <form id="myForm">10 <div>11 <input type="text" name="username" id="username" value="测试姓名" />12 </div>13 <div>14 <input type="password" name="password" value="测试密码" />15 </div>16 <div>17 <input type="text" name="email" value="test@add.com" />18 </div>19 <div>20 <input type="submit" name="submitsss" value="提交" />21 </div>22 </form>23 <script type="text/javascript">24 $("#myForm").validate({25 messages: { email: { remote: "该用邮箱已经被注册!"} },26 rules: {27 email: {28 required: true,29 email: true,30 remote: {31 url: "validate.aspx",32 type: "post"33 }34 }35 }36 });37 </script>38 </body>39 </html>

 

jquery.validate小注