<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="https://static.runoob.com/assets/jquery-validation-1.14.0/lib/jquery.js"></script>
<script src="https://static.runoob.com/assets/jquery-validation-1.14.0/dist/jquery.validate.min.js"></script>
<script>
//validator 英[ˈvælɪdeɪtə] 验证控件; 验证器; 校验器; 验证; 验证程序;
$.validator.setDefaults({
submitHandler: function() {
alert("提交事件!");
}
});
$().ready(function() {
$("#commentForm").validate();
});
</script>
</head>
<body>
<form id="commentForm" method="get" action="">
用户名: <input type="text" name="username" /><br/>
<input type="submit" value="tijiao" />
</form>
</body>
</html>