jQuery : Disable holidays in jQuery UI calendar

May 19th, 2012 § 0 comments

Here is the simple way to disable custom holidays in a JQuery UI calendar. Here for example I took may 1, 2, and 3 to disable.
The trick lies in the beforeShowDay event. This event will be triggered before showing each day on calendar. It returns an array of 3 elements.

  1. true or false : false to disabled date.
  2. CSS class : A css class to style a particular day
  3. Tooltip Text : To show the description for a day.

The defaultDate option which I used, just to make sure this code always shows the May, 2012, else the datepicker will show the current month.

Hope you find it helpful.
Thank you.

Revath S Kumar [RSK]

- Rubyist / JavaScripter - Yeoman Team member - Open source enthusiast - Blogger @ PHPRepo and http://blog.revathskumar.com - Coder @ Whatznear - Google fanboy - jQuery lover

More Posts - Website - Twitter - Facebook - LinkedIn - Pinterest - Google Plus - YouTube