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

為了賬號安全,請及時綁定郵箱和手機立即綁定

代碼是看著老師的代碼敲的,可是運行有錯誤

<!DOCTYPE?html>
<html>
<head>
<meta?charset="UTF-8">
<title>validate-demo</title>
<style?type="text/css">
body?{
font-size:?36px;
line-height:?1.6;
}
p?{
margin:?10px?0;
}
label?{
display:?inline-block;
min-width:?140px;
}
label?.error?{
margin-left:?10px;
color:?red;
}
input,button?{
line-height:?35px;
border:?1px?solid?#999;
min-width:?180px;
}
input?.error?{
border:?1px?solid?red;
}
input[type=submit],button?{
margin-top:?20px;
font-size:?36px;
padding:?10px?0;
}
</style>
</head>
<body>
<form?id="demoForm">
<fieldset>
<legend>用戶登錄</legend>
<p>
<label?for="username">用戶名</label>
<input?type="text"?id="username"?name="username"?/>
</p>

<p>
<label?for="password">密碼</label>
<input?type="password"?id="password"?name="password"?/>
</p>

<p>
<input?type="submit"?value="登錄"?/>
</p>
</fieldset>
</form>
<script?src="jquery-3.1.0.min.js"></script>
<script?src="jquery.validate.js"></script>
<script>
$(document).ready(function(){
rules:{
username:{
required:true,
minlength:2,
maxlength:10
},
password:{
required:true,
minlength:2,
maxlength:16
}
},
messages:{
username:{
required:"用戶名不能為空",
minlength:"用戶名最少為2位",
maxlength:"用戶名最多為10位"
},
password:{
required:"密碼不能為空",
minlength:"密碼最少為2位",
maxlength:"密碼最多為16位"
}
}
});
</script>
</body>
</html>


正在回答

2 回答

$(function(){
??????? $('#idform').validate({
??????????? rules:{
??????????????? username:{
??????????????????? required:true,
??????????????????? minlength:2,
??????????????????? maxlength:6
??????????????? },
??????????????? password:{
??????????????????? required:true,
??????????????????? minlength:2,
??????????????????? maxlength:6
??????????????? }
??????????? }
??????? })
??? });

要獲取表單ID

0 回復 有任何疑惑可以回復我~
#1

weibo_豬豬豬惠婷_0 提問者

我修改之后還是不行,還有哪里出錯了嗎
2016-11-02 回復 有任何疑惑可以回復我~

$('#idform').validate最重要的東西,你都沒引用插件

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

代碼是看著老師的代碼敲的,可是運行有錯誤

我要回答 關注問題
微信客服

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

幫助反饋 APP下載

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

公眾號

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