我正在使用jQuery validation plugin,我在几个登录表单上尝试了它,它运行正常。
但是现在我需要在联系表单上这样做而且它不起作用
这是代码
<script src="js/jquery.validate.js">
</script>
<script>
$(document).ready(function() {
$(".contacts-form").validate({
rules: {
name: "required",
email: {
required: true,
email: true
},
message: "required"
},
messages: {
name: "Please enter a name",
email: {
required: "Please enter email",
email: "Invalid Email"
},
message: "Please enter message"
}
})
});
</script>
这是html
<form method="POST" action="contacts-back-end.php" class="contacts-form">
<input type="text" placeholder="Name*" name="name">
<input type="email" placeholder="Email*" name="email">
<input type="text" placeholder="About" name="about">
<textarea placeholder="Message*" rows="10" name="message"></textarea>
<input type="submit" value="Send" class="button">
</form>