Here Laxmikant has explained with an example, how to block the particular weekdays in the jquery datepicker?
Basically, Datepicker allows users to click the all weekdays. If you want to block any weekdays
for example : allmost company has holidays on saturday and sunday.
We can appointment with the company except Saturdey and Sunday. In this case we want to block the saturdays and sundays in the datepicker.
Click this link for integrate the jQuery datepicker
Weekdays datepicker values
[php]
Index
0 – Sunday
1 – Monday
2 – Tuesday
3 – Wednesday
4 – Thursday
5 – Friday
6 – Saturday
[/php]
Key Point:
If you want to block any paricular 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 . If you want block monday and Tuesdat using the index numbers 1 and 2.
jQuery Code:block the particular weekdays in the jquery datepicker
[php]
<script>
$(document).ready(function () {
$(‘#txtDate’).datepicker({
beforeShowDay:
function (date) {
return [date.getDay() == 0 || date.getDay() == 6 ? false : true];
}
});
});
</script>
[/php]