How to block the particular weekdays in the jquery datepicker

Generally Datepicker allows to click the all weekdays do you want to block any weekdays
for example : a company has holidays on saturday and sunday.
We can appointment with the company except these holidays. In this case we want to block the saturdays and sundays in the datepicker
We already know about how to integrate the jquery datepicker.
Datepicker weekday values are
0 - Sunday
1 - Monday
2 - Tuesday
3 - Wednesday
4 - Thursday
5 - Friday
6 - Saturday
If you want to block any weekday in the datepicker just use the index numbers instead of using the weekdays.
Now will block the saturday and sundays then we use the index numbers 6 and 0 .
 $(document).ready(function () {  
        $('#txtDate').datepicker({ beforeShowDay:  
           function(dt)  
           {  
             return [dt.getDay() == 0 || dt.getDay() == 6 ? false : true];  
           }  
       });  
      });  

Download Watch Demo
* If you like this post please don’t forget to subscribe Techies Badi - programming blog for more useful stuff


EmoticonEmoticon