简体   繁体   中英

How to make all future dates non-clickable

I want to disable all future dates in the calendar after today. Today's date is highlighted in Yellow ( Feb 23rd 2012 )in the diagram below. All the other future dates should be non clickable. How can i do that ?

For instance 24th,25th.... etc should not be clickable

在此输入图像描述

Note: $('.datepicker').BlackoutDates.Add(new CalendarDateRange(DateTime.Now.AddDays(1), DateTime.MaxValue)); doesn't work

If you are using JQuery UI datepicker calandar, use maxdate method : http://api.jqueryui.com/datepicker/#option-maxDate

$( ".selector" ).datepicker({ maxDate: new Date() });

new Date() corresponds to the current date

demo : http://jsfiddle.net/UQTY2/21/

if the datepicker wizard has already been initialized on the input, you can also use:

    $( ".selector" ).datepicker("option", {maxDate: "+0D" });

That should also work when a day ends and a new day starts after the datepicker has been initialized.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM