Last active
November 3, 2015 11:31
-
-
Save vanbernaert/4dd1557abda08e7be90a to your computer and use it in GitHub Desktop.
Gravity Forms: restrict days on datepicker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(function () { | |
// 0 = monday, 1 = tuesday, 2 = wednesday, 3 = thursday, | |
// 4=friday, 5 = saturday, 6=sunday | |
var daysToDisable = [2, 4, 5]; | |
jQuery("#input_id_id").datepicker({ | |
beforeShowDay: disableSpecificWeekDays | |
}); | |
function disableSpecificWeekDays(date) { | |
var day = date.getDay(); | |
for (i = 0; i < daysToDisable.length; i++) { | |
if (jQuery.inArray(day, daysToDisable) != -1) { | |
return [false]; | |
} | |
} | |
return [true]; | |
} | |
}); | |
// source: http://codeasp.net/blogs/microsoft-net/767/jquery-datepicker-disable-specific-weekdays |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment