How to Datepicker picks future dates only and disable past date in JQuery and CSS?

Which class should be used for datepicker to use future dates only?

<form:input path="FutureDato" type="date" class="datepicker maxDateToday hasDatepicker" />

Note: The code is written by someone else. The above code does not allow to enter future date or you can say disable future dates on calendar click. I want code to disable past dates and show future date years only. I am unable to get how these classes (datepicker, maxDateToday) worked here; unable to find it in CSS. I do not know whether above execute by JQuery; if yes then i am unable to search the same. If such classes are predefined then could you please help me finding the class?

Answer

To make any past dates unselectable, you first have to find the instantiation of the datepicker, and set the minDate setting to zero.

$('element').datepicker({
    minDate : 0
});

Leave a Reply

Your email address will not be published. Required fields are marked *