I have a jQuery datepicker on my website, and I have disabled every first and second day (monday and tuesday) of the week. Also I have an array of days which are disabled (this
Just use the following condition inside your beforeShowDay
function. It basically creates an exception for specified dates:
var override = ["24-12-2018"];
// ...
var available = (dt.getDay() == 1 || dt.getDay() == 2 || vakantie.indexOf(datestring) >= 0) && (override.indexOf(datestring) === -1)
? false
: true;
return [available];
var vakantie = ["25-12-2018", "26-12-2018", "27-12-2018", "28-12-2018", "29-12-2018", "30-12-2018", "31-12-2018"];
var override = ["24-12-2018"];
function nietbeschikbaar(dt) {
var datestring = jQuery.datepicker.formatDate('dd-mm-yy', dt);
var available = (dt.getDay() == 1 || dt.getDay() == 2 || vakantie.indexOf(datestring) >= 0) && (override.indexOf(datestring) === -1)
? false
: true;
return [available];
}
jQuery("#cfgen-element-7-6").datepicker(jQuery.datepicker.regional["nl"]);
jQuery("#cfgen-element-7-6").datepicker("option", "changeMonth", true);
jQuery("#cfgen-element-7-6").datepicker("option", "changeYear", true);
jQuery("#cfgen-element-7-6").datepicker("option", "minDate", +1);
jQuery("#cfgen-element-7-6").datepicker("option", "firstDay", 1);
jQuery("#cfgen-element-7-6").datepicker("option", "dateFormat", "dd-mm-yy");
jQuery("#cfgen-element-7-6").datepicker("option", "yearRange", "-0:+70");
jQuery("#cfgen-element-7-6").datepicker("option", "beforeShowDay", nietbeschikbaar);
@import url("https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/blitzer/jquery-ui.min.css");
Navigate to December 2018