JQuery表单:日期验证

时间:2014-06-09 15:24:14

标签: jquery forms validation

我有一张表格,其中有一些"随你而去的#34;验证到位,它适用于我的电子邮件输入和邮政编码,但我不知道如何验证出生日期字段(dob)的特定格式。

有什么想法吗?

<script>
$(document).ready(function(){

  $("#inquiry-fantasy").validate({
   errorContainer: ".messageBox",
   errorLabelContainer: ".messageBox ul",
   wrapper: "li",
});

$("#zip").rules("add", {
 digits: true,
 minlength: 5,
 maxlength: 5,
 messages: { digits: "Please enter a 5 digit zipcode", minlength: "Please enter a 5 digit zipcode", maxlength: "Please enter a 5 digit zipcode"}
});

$("#email").rules("add", {
 required: true,
 minlength: 5,
 messages: { required: "Please Enter your Email Address"}
});

$("#dob").rules("add", {
 digits: true,
 messages: { digits: "Please enter your date of birth in MM/DD/YYYY format"}
});

});
</script>

0 个答案:

没有答案