开发者

How the jquery Datepicker set some date to highlight?

开发者 https://www.devze.com 2023-04-07 01:47 出处:网络
I\'m use jquery Datepicker [link:http://docs.jquery.com/UI/Datepicker] now,and if I want Set some date to highlight, not just highlight the date now, how can I set the option?

I'm use jquery Datepicker [link:http://docs.jquery.com/UI/Datepicker] now,and if I want Set some date to highlight, not just highlight the date now, how can I set the option?

For examp开发者_Go百科le:

How the jquery Datepicker set some date to highlight?

There I want 24/09/2011, 25/09/2011 and 27/09/2011 to highlight.


You'll have to use the beforeShowDay option:

var dates = []; // array of the dates you want to highlight, stored as strings

$('selector').datepicker({
    beforeShowDay: function(date) {
        if ($.inArray(date.toString(), dates) != -1) {
            return [true, 'highlight'];
        }
    }
});

See this question for more information:

Can the jQuery UI Datepicker be made to disable Saturdays and Sundays (and holidays)?

0

精彩评论

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

关注公众号