How the jquery Datepicker set some date to highlight?

六月ゝ 毕业季﹏ 提交于 2019-12-30 11:32:09

问题


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 example:

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


回答1:


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)?



来源:https://stackoverflow.com/questions/7523653/how-the-jquery-datepicker-set-some-date-to-highlight

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!