jquery Datepicker如何设置一些日期以突出显示? [英] How the jquery Datepicker set some date to highlight?

查看:88
本文介绍了jquery Datepicker如何设置一些日期以突出显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jquery Datepicker [link:


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

这篇关于jquery Datepicker如何设置一些日期以突出显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆