jQuery UI Datepicker detect select
When a date is selected开发者_JS百科 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,'',''];
}
});
精彩评论