简体   繁体   中英

How the jquery Datepicker set some date to highlight?

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM