Note that there are some explanatory texts on larger screens.

plurals
  1. PODisable specific dates in jquery
    text
    copied!<p>I am using the jquery date picker found here: <a href="http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/datePickerStartEnd.html" rel="nofollow noreferrer">http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/datePickerStartEnd.html</a> that allows the user to pick a start and end date.</p> <p>However I want to be able to disable specific dates.</p> <p>I tried to implement the code found here: <a href="https://stackoverflow.com/questions/501943/can-the-jquery-ui-datepicker-be-made-to-disable-saturdays-and-sundays-and-holida">stackoverflow.com/questions/501943/can-the-jquery-ui-datepicker-be-made-to-disable-saturdays-and-sundays-and-holida</a> that discusses disabling national holidays.</p> <p>Here is my complete code:</p> <pre><code>$(function() { $('.date-pick').datePicker({ beforeShowDay: nationalDays}) // $(".selector").datepicker({ beforeShowDay: nationalDays}) var 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, '']; } $('#start-date').bind( 'dpClosed', function(e, selectedDates) { var d = selectedDates[0]; if (d) { d = new Date(d); $('#end-date').dpSetStartDate(d.addDays(1).asString()); } } ); $('#end-date').bind( 'dpClosed', function(e, selectedDates) { var d = selectedDates[0]; if (d) { d = new Date(d); $('#start-date').dpSetEndDate(d.addDays(-1).asString()); } } ); }); </code></pre> <p>But this does not seem to work.</p> <p>I would really appreciate any assistance with solving this!</p>
 

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