<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="js/jquery-1.10.0.js"></script>
<script type="text/javascript" src="js/jquery.validate-1.13.1.js"></script>
</head>
<body>
<div>
<form><input type="text" name="username">
<input type="submit" value="提交">
</form></div>
<script>
$(document).ready(function() {
$(".form").eq(0).validate({
debug:true,
rules:{
username:{
required:true,
minlength:6,
maxlength:15,
remote:"remote.json"
}
},
messages:{
username:{
required:"用户名必须填写",
minlength:"最小长度为6",
maxlength:"最大长度为15",
}
}
})
})
</script>
</body>
</html>
相关分类