Minimum age with the jQuery UI Datepicker
Just been working on a registration form where the minimum age of registering users has to be 18. Using the fabulous jQuery UI Datepicker (see documentation it’s really easy to set up a Date of Birth field so that the a user has to be a least 18 years old.
$(function() {
$("#dob").datepicker(
{
minDate: new Date(1900,1-1,1), maxDate: '-18Y',
dateFormat: 'dd/mm/yy',
defaultDate: new Date(1970,1-1,1),
changeMonth: true,
changeYear: true,
yearRange: '-110:-18'
}
);
});