慕用3882092
2017-03-13 17:14
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>validate插件</title>
<script src="/验证插件/jquery-1.10.0.js" type="text/javascript"></script>
<script src="/验证插件/jquery.validate-1.13.1.js" type="text/javascript"></script>
<style>
body{
font-size:20px;
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: 20px;
border:1px solid #999999;
min-width: 180px;
}
input.error{
border: 1px solid red;
}
input[type=submit],button{
margin-top: 20px;
font-size: 20px;
padding: 10px 0;
}
</style>
</head>
<body>
<form id="demoForm" style="border: 1px solid red">
<fileset>
<legend>用户登录</legend>
<p>
<label for="username">用户名</label>
<input type="text" id="username" name="username">
</p>
<p>
<label for="password">密码    </label>
<input type="text" id="password" name="password">
</p>
<p>
<input type="submit" value="登录">
</p>
</fileset>
</form>
<script type="text/javascript">
$(document).ready(function () {
$("#demoForm").validate({
rules:{
username:{
required:true,
minlength:2,
maxlength:10
},
password:{
required:true,
minlength:2,
maxlength:16
}
}
});
});
</script>
</body>
</html>
插件地址问题,我这边测试没什么问题!
jQuery插件——Validation Plugin
65871 学习 · 216 问题
相似问题