亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

急急急?。。£P于jQuery插件validate的問題,下面一段代碼,當輸入不正確的信息為什么沒有提示?

急急急?。?!關于jQuery插件validate的問題,下面一段代碼,當輸入不正確的信息為什么沒有提示?

IT菜_鳥 2016-04-14 20:51:37
<!DOCTYPE html><html><head> <meta charset="utf-8"> <title>表單驗證</title> <style type="text/css"> body{margin: 0;padding: 0} form{margin: 50px 100px;height: auto;} legend{font-size: 24px;font-weight: bold} p label{font-size: 18px;font-family: 微軟雅黑;display: inline-block;width: 80px;} p input{width: 140px;height: 20px;line-height: 20px;font-size: 16px} #sub{width: 80px;height: 30px;} form p:last-child{margin-left: 80px;margin-bottom: 10px} </style> <script src="jquery.validate-1.13.1.js"></script> <script src="jquery-1.11.3.min.js"></script> <script type="text/javascript"> $(function(){ validator = $("#demoForm").validate({ rules: {? ? ? ? ? ? ? ? username: {? ? ? ? ? ? ? ? ? ? required: true,? ? ? ? ? ? ? ? ? ? minlength: 2,? ? ? ? ? ? ? ? ? ? maxlength: 10? ? ? ? ? ? ? ? },? ? ? ? ? ? ? ? password: {? ? ? ? ? ? ? ? ? ? required: true,? ? ? ? ? ? ? ? ? ? minlength: 2,? ? ? ? ? ? ? ? ? ? maxlength: 16? ? ? ? ? ? ? ? },? ? ? ? ? ? ? ? "confirm-password": {? ? ? ? ? ? ? ? ? ? equalTo: "#password";? ? ? ? ? ? ? ? }? ? ? ? ? ? },? ? ? ? ? ? messages: {? ? ? ? ? ? ? ? username: {? ? ? ? ? ? ? ? ? ? required: '請輸入用戶名',? ? ? ? ? ? ? ? ? ? minlength: '用戶名不能小于2個字符',? ? ? ? ? ? ? ? ? ? maxlength: '用戶名不能超過10個字符',? ? ? ? ? ? ? ? },? ? ? ? ? ? ? ? password: {? ? ? ? ? ? ? ? ? ? required: '請輸入密碼',? ? ? ? ? ? ? ? ? ? minlength: '密碼不能小于2個字符',? ? ? ? ? ? ? ? ? ? maxlength: '密碼不能超過16個字符'? ? ? ? ? ? ? ? },? ? ? ? ? ? ? ? "confirm-password": {? ? ? ? ? ? ? ? ? ? equalTo: "兩次輸入密碼不一致"? ? ? ? ? ? ? ? }? ? ? ? ? ? } }) }) </script></head><body> <form id="demoForm"> <fieldset> <legend>會員登錄</legend> <p id="info"></p> <p> <label for="username">用戶名:</label> <input type="text" name="username" id="user"> </p> <p> <label for="password">密&nbsp;&nbsp;碼:</label> <input type="password" name="password" id="psd"> </p> <p> <label for="confirm-password">確認密碼:</label> <input type="password" name="confirm-password" id="conf"> </p> <p> <input type="submit" ?id="sub" name="submit" value="提交"> </p> </fieldset> </form> </body></html>
查看完整描述

1 回答

已采納
?
一米一一3192659

TA貢獻4條經驗 獲得超6個贊

<label for="password">密&nbsp;&nbsp;碼:</label>

<input type="password" name="password" id="psd">

</p>

<p>

<label for="confirm-password">確認密碼:</label>

<input type="password" name="confirm-password" id="conf">


equalTo: "#password"; ?應該是?equalTo: "#psd";


查看完整回答
反對 回復 2016-04-14
  • IT菜_鳥
    IT菜_鳥
    我修改了,還是不行啊
  • 一米一一3192659
    一米一一3192659
    <script src="jquery.validate-1.13.1.js"></script> <script src="jquery-1.11.3.min.js"></script> 這兩個 引入順序不對,把下邊的放上邊jquery我都用1.9的了....你這換換吧... 反正不管版本,這倆順序不對,你緩過來試試
  • IT菜_鳥
    IT菜_鳥
    恩恩,jquery的版本太低了,我換了更高級的版本果然有用,謝謝
  • 1 回答
  • 0 關注
  • 1455 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號