开发者

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,'',''];
    }
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜