How to change default highlighted “today” date in datepicker

前端 未结 6 2047
粉色の甜心
粉色の甜心 2020-12-19 14:26

I\'m using datepicker for selecting dates in two date fields (from date and to date).

In those, the default highlighted date is today date. I need to change the defa

6条回答
  •  庸人自扰
    2020-12-19 14:49

    Another solution to highlight the defaultDate is to override a CSS class which corresponds to the chosen defaultDate:

    .ui-datepicker td.ui-datepicker-days-cell-over a {
        background: #7ca600;
    }
    

    Demo jsfiddle: http://jsfiddle.net/0vjadze4/ (highlight both today and defaultDate)

    Of course, you can combine that with the answer provided by Mickael, to highlight only defaultDate:`

    .ui-datepicker td.ui-datepicker-days-cell-over a {
        background: #7ca600;
    }
    .ui-datepicker-today a.ui-state-highlight {
        border-color: #d3d3d3;
        background: #e6e6e6 url(/themeroller/images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x;;
        color: #555555;    
    }
    .ui-datepicker-today.ui-datepicker-current-day a.ui-state-highlight {
        border-color: #aaaaaa;
        background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x;
        color: #212121;
    }
    

    Demo jsfiddle: http://jsfiddle.net/43svpe80/1/ (highlight only defaultDate)

提交回复
热议问题