Created
January 11, 2013 08:31
-
-
Save crishnakh/4508952 to your computer and use it in GitHub Desktop.
Disable days in jQuery datepicker from http://tokenposts.blogspot.ca/2011/05/jquery-datepicker-disable-specific.html
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
<script type="text/javascript"> | |
var unavailableDates = ["11-1-2013","12-1-2013","13-1-2013"]; | |
function unavailable(date) { | |
dmy = date.getDate() + "-" + (date.getMonth()+1) + "-" + date.getFullYear(); | |
if ($.inArray(dmy, unavailableDates) < 0) { | |
return [true,"","Book Now"]; | |
} else { | |
return [false,"","Booked Out"]; | |
} | |
} | |
</script> | |
<input type="datetime" name="id" id="id" placeholder="YYYY/MM/DD"> | |
<script type="text/javascript"> | |
$('#id').datepicker({dateFormat: 'YYY/MM/DD', changeMonth: true, changeYear: true, yearRange: '+0:+0',beforeShowDay: unavailable}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment