h1

Disable Specified Day in Datepicker

April 3, 2012

Pass the date to this function which will be disable .

Function:

function isAvailable(date)
{
dateAsString = date.getFullYear().toString() + “-” + (date.getMonth()+1).toString() + “-” + date.getDate();
var dateNo = date.getDate() < 10 ? ‘0’+date.getDate() : date.getDate();
var monthNo = (date.getMonth()+1) < 10 ? ‘0’+(date.getMonth()+1) : (date.getMonth()+1);
var dateAsString = dateNo + “/” + monthNo + “/” + date.getFullYear().toString() ;var result = $.inArray( dateAsString, HideDate) ==-1 ? [true] : [false];
return result
}

Function For DatePicker:

function
{
$(“#txtDate”).datepicker({minDate:-15,maxDate:3,beforeShowDay: isAvailable});
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: