When a date is selected by the user, I want to check a condition and cancel the selection
onSelect: function(dateText) {
// code to cancel selection
}
How do i cancel it?
When a date is selected by the user, I want to check a condition and cancel the selection
onSelect: function(dateText) {
// code to cancel selection
}
How do i cancel it?
Use the beforeShowDay event.
So:
$(/*...*/).datepicker({
beforeShowDay: function(date) {
if(disableCondition)
return [true,'','You can\'t select this!'];
else
return [false,'',''];
}
});