-
-
Save deckerweb/1e17c328b5f36adfecb5 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
Thanks, this is just what I needed in order to remove specific days from a Gravity Form Date picker in Wordpress. What I like about this solution is it allows you to trigger it only for a specific ID unlike other solutions that change all date pickers.