日期:2014-05-17 浏览次数:20453 次
<script src="/Scripts/jquery-1.7.1.js"></script>
<!--jQuery Validation Plugin 1.9.0-->
<script type="text/javascript" src="/Scripts/jquery.validate.min.js"></script>
<!--JS 代码-->
$(document).ready(function () {
$("#loginForm").validate({
rules: {
password: { required: true },
email: {
required: true,
email: true
}
},
messages: {
password: { required: "请输入密码" },
email: {
required: "请输入电子邮件地址",
email: "请输入正确的电子邮件地址"
}
},
errorPlacement: function (error, element) {
error.appendTo(element.next("span"));
}
});
});
<!--Form 代码-->
<form action="/Home/Login" id="loginForm" method="post">