2

我尝试操纵 jquery 的日期选择器,因为我想要一个多选。现在我想更改所选日期的样式,例如将文本设为绿色。我不知道如何改变风格。有没有可能?

谢谢你的帮助!

这是我的代码:

$(".testpicker").datepicker({

    numberOfMonths: 2,
    showButtonPanel: false,
    onSelect: function(test,object){
        console.log(object.id);

        //#####My first tries######//:
        $("#"+object.id).css('color','green');
        $(this).css('background-color','white');
        //###########//

        if(~$.inArray(test,dates))
        {
            console.log(test)
        }
        else
        {
            dates.push(test);
        }
        console.log(dates);
        console.log(object);
        //prevents closing
        $(this).data('datepicker').inline = true;
    },
    onClose: function() {
        $(this).data('datepicker').inline = false;
    }
});
4

2 回答 2

2

要更改 datepicker 中选定日期的颜色,请在您的 jsp 页面上使用以下 css:

#ui-datepicker-div .ui-state-highlight {
   background:red;
}
于 2013-07-23T12:03:06.500 回答
0

我认为您需要打开检查器(萤火虫)并查看分配给选定单元格的类(选定日期)。

例如今天的这一天被赋予类.ui-state-highlight

您选择的日期被授予班级.ui-state-active

于 2013-05-13T10:45:18.880 回答