莫小北没有故事
2016-01-23 16:11
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery动画特效</title>
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
</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="num" id="password" name="password" />
</p>
<p>
<input type="submit" name="" id="" value="登录" />
</p>
</fieldset>
</form>
</body>
<script type="text/javascript" src="jquery-1.12.0.min.js" ></script>
<script src="jquery-validation-1.14.0/dist/jquery.validate.js"></script>
<script>
$(document).ready(function(){
$("#demoForm").validate({
rules:{
username:{
require:true,
minlength:2,
maxlength:10
},
password:{
require:true,
minlength:2,
maxlength:16
}
}
});
});
</script>
</html>
是required吧,你少了个d
jQuery插件——Validation Plugin
65871 学习 · 216 问题
相似问题