tags:

views:

16

answers:

1

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?

A: 

Use the beforeShowDay event.

So:

$(/*...*/).datepicker({
    beforeShowDay: function(date) {
        if(disableCondition)
            return [true,'','You can\'t select this!'];
        else
            return [false,'',''];
    }
});
Eric