How to disable future dates in Datepicker

If you need the restriction that user cannot select a date in the Datepicker from the future, then there are 2 easy ways to do this.

You must add the maxDate parameter with a value of 0 or the current date “new Date()” at Datepicker initialization. 

An example: 

 $(function() {
$( "#mydate" ).datepicker({ maxDate: new Date() });
});

Alternative: 

$(function() {
$( "#mydate" ).datepicker({ maxDate: 0 });
});

Comments

No comments yet, you can leave yours: