jQuery Enable/Disable Specific Date

In web application most of people use jQuery, jQuery UI and jQuery Plug-ins. Why not? First of all it’s free and it reduces no. of code. Any way what i want to say is today one of my client wanted to download data according to date. i.e. Data generated on specific date. Date will be increase day by day so I thought what I need to do? Suddenly, there is a click in mind jQuery UI Datepicker has ability to enable/disable date so I just googled for that and got the code. I really thank TutorBoy.com as they have done this beauty of a code. Let’s see below code how to enable/disable date using jQuery UI datepicker. I hope it may be helpful for you.

[code:js]
var enabledDays = [’11-3-2010′,’12-12-2010′];
function enableAll(date) {
var m = date.getMonth() + 1, d = date.getDate(), y = date.getFullYear();
for (i = 0; i < enabledDays.length; i++) {
if($.inArray(m + ‘-‘ + d + ‘-‘ + y,enabledDays) != -1) {
return [true]; // If you want to disabled this date just return false from here and return true end of the function instead of return false;
}
}
return [false];
}
jQuery(function(){
jQuery(‘#datePick’).datepicker({
beforeShowDay: enableAll,
onSelect : function(date){alert(date)}
});
})
[/code]