Datepicker validation 18 years of age [closed]

If you look down the demo page a bit, you’ll see a “Restricting Datepicker” section. Use the dropdown to specify the “Year dropdown shows last 20 years” demo , and hit view source:

$("#restricting").datepicker({ 
    yearRange: "-20:+0", // this is the option you're looking for
    showOn: "both", 
    buttonImage: "templates/images/calendar.gif", 
    buttonImageOnly: true 
});

You’ll want to do the same (obviously changing -20 to -100 or something).

Or you can use

$('#dp1').datepicker({
    format: 'mm-dd-yyyy',
    startDate: '-15d',
    endDate: '+0d' // there's no convenient "right now" notation yet
});

Leave a Comment