jQuery - how to validate a date of birth using jQuery Validation plugin?
date, jquery, jquery-validate
Solution
I find the answer :D this is it. Thanks all
$.validator.addMethod("birth", function (value, element) {
var year = value.split('/');
if ( value.match(/^\d\d?\/\d\d?\/\d\d\d\d$/) && parseInt(year[2]) <= 2002 )
return true;
else
return false;
});
Problem
I want to validate an input ( date of birth ) using jQuery Validation plugin, but it must be in format "dd/mm/yyyy" and also not validate when the date of year is over 2002. So the date is valid when it's in this format "dd/mm/yyyy" and year over "2002"