我正在使用 jQuery Validate 插件来验证我的表单,如何使用此日期格式 DD-MMM-YYY(2012 年 3 月 23 日)验证自定义日期。
创建自定义验证器 http://docs.jquery.com/Plugins/Validation/Validator/addMethod#namemethodmessage:
jQuery.validator.addMethod("mydate", function(value, element) {
return this.optional(element) || /^\d\d?-\w\w\w-\d\d\d\d/.test(value);
}, "Please specify the date in DD-MMM-YYYY format");
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)