Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There is the <code>beforeShowDay</code> option, which takes a function to be called for each date, returning true if the date is allowed or false if it is not. From the docs:</p> <hr> <p><strong>beforeShowDay</strong> </p> <p>The function takes a date as a parameter and must return an array with [0] equal to true/false indicating whether or not this date is selectable and <a href="http://jqueryui.com/demos/datepicker/#event-beforeShowDay" rel="noreferrer">1</a> equal to a CSS class name(s) or '' for the default presentation. It is called for each day in the datepicker before is it displayed.</p> <p>Display some national holidays in the datepicker.</p> <pre><code>$(".selector").datepicker({ beforeShowDay: nationalDays}) natDays = [ [1, 26, 'au'], [2, 6, 'nz'], [3, 17, 'ie'], [4, 27, 'za'], [5, 25, 'ar'], [6, 6, 'se'], [7, 4, 'us'], [8, 17, 'id'], [9, 7, 'br'], [10, 1, 'cn'], [11, 22, 'lb'], [12, 12, 'ke'] ]; function nationalDays(date) { for (i = 0; i &lt; natDays.length; i++) { if (date.getMonth() == natDays[i][0] - 1 &amp;&amp; date.getDate() == natDays[i][1]) { return [false, natDays[i][2] + '_day']; } } return [true, '']; } </code></pre> <p>One built in function exists, called noWeekends, that prevents the selection of weekend days.</p> <pre><code>$(".selector").datepicker({ beforeShowDay: $.datepicker.noWeekends }) </code></pre> <hr> <p>To combine the two, you could do something like (assuming the <code>nationalDays</code> function from above):</p> <pre><code>$(".selector").datepicker({ beforeShowDay: noWeekendsOrHolidays}) function noWeekendsOrHolidays(date) { var noWeekend = $.datepicker.noWeekends(date); if (noWeekend[0]) { return nationalDays(date); } else { return noWeekend; } } </code></pre> <p><strong>Update</strong>: Note that as of jQuery UI 1.8.19, the <a href="http://jqueryui.com/demos/datepicker/#event-beforeShowDay" rel="noreferrer">beforeShowDay option</a> also accepts an optional third paremeter, a popup tooltip </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload