<body>
<form id="leform">
<fieldset>
<legend>用户登录</legend>
<p>
<label for="iusername">用户名</label>
<input type="text" name="nusername" id="iusername">
</p>
<p>
<label for="ipassword">密码</label>
<input type="password" name="npassword" id="ipassword">
</p>
<p>
<label for="icomfirm-password">确认密码</label>
<input type="password" name="nconfirm-password" id="icomfirm-password">
</p>
<p>
<input type="submit" value="登录">
</p>
</fieldset>
</form>
<script src="vendor/jquery-1.10.0.js"></script>
<script src="vendor/jquery.validate-1.13.1.js"></script>
<script>
$(document).ready(function(){
$("#leform").validate({
rules:{
nusername:{
required:true,//必填
minlength:2,
maxlength:10
},
npassword:{
required:true,//必填
minlength:2,
maxlength:16
},
"nconfirm-password": {
equalTo: "#ipassword"
},
messages:{
nusername:{
required: "请输入用户名",
maxlength: "用户名不能超过10个字符",
minlength: "用户名不能小于2个字符"
},
npassword:{
required: '请输入密码',
minlength: '密码不能小于2个字符',
maxlength: '密码不能超过16个字符'
},
"nconfirm-password":{
equalTo: "两次输入密码不一致"
},
},
},
});
});
</script>
</body>
required: "请输入用户名",
required:"请输入用户名",
你的冒号或者双引号有一个是中文格式吧