Alex Rivera | Logout

Disable future dates in jQuery UI Datepicker

Asked 2010-10-23T06:16:53.473
77

Is it possible to disable future date from today?

Let say today is 23/10/2010, so 24/10/2010 onwards are disabled.

Sorry I am very new in jQuery and JavaScript.

Edit
Report

3 Answers

128

Yes, indeed. The datepicker has the maxdate property that you can set when you initialize it.

Here's the codez

$("#datepicker").datepicker({ maxDate: new Date, minDate: new Date(2007, 6, 12) });
answered 2010-10-23T06:20:41.857
38
$(function() { $("#datepicker").datepicker({  maxDate: '0'}); });
answered 2010-10-23T06:22:43.743
3

Code for Future Date only with disable today's date.

 var d = new Date();
         $("#delivdate").datepicker({
         showOn: "button",
         buttonImage: base_url+"images/cal.png",
         minDate:new Date(d.setDate(d.getDate() + 1)),
         buttonImageOnly: true
        });
         $('.ui-datepicker-trigger').attr('title',''); 
answered 2012-11-09T06:55:47.263

Your Answer