JQuery datepicker color sunday red

Is there a way to change the color, like red, on Sundays in jQuery Datepicker?

+5
source share
7 answers

On Sundays and Saturdays, you can use the fact that the jquery datepicker adds a class .ui-datepicker-week-endso that you can add a .ui-datepicker-week-end{color:#f00;}css file to you.

If you want to process only on Sundays, you must relay on the fact that this will be the first or last column in the table generated by jQuery datepicker (language dependent).

: firefox + firebug ( sh similiar) html-. , , DOM jquery.

+3

ui.datepicker.js( ) .ui-datepicker-week-end, ( ), .

ui.datepicker.js " " if: (t+h+6)%7>=5? → 5 == 6 .ui- datepicker-week-end .

(t+h+6)%7==6?" ui-datepicker-week-end":""

CSS :

.ui-datepicker-week-end {
    background: #f00;
}
+3
$('#something').datepicker({
    beforeShowDay:function(date){
        if(date.toString().indexOf('Sun ')!=-1)
            return [1,'red'];else
            return [1];
    }
}

css:

.ui-datepicker td.red a{
color:#f00 !important;
}    

, .

+3

, , jQuery :

$('table.ui-datepicker-calendar td.ui-datepicker-week-end:nth-child(1) a').css({'background':'#f00'});

, , . , .

css3, IE.

table.ui-datepicker-calendar td.ui-datepicker-week-end:nth-child(1) a
{
    background: #f00;
}
+2

, , CSS:

.ui-datepicker-week-end, .ui-datepicker-week-end a.ui-state-default {color: #C00;}
+1

Theming HTML, . HTML:

.ui-datepicker-calendar > tbody td:first-child {
    background-color: red;
}

JQuery

$(".ui-datepicker-calendar > tbody td:first-child").css("background-color: red");

, - , . , :nth-child(n).

0

, css

.datepicker table tr td:first-child {
 color: red
 }

.datepicker table tr td:first-child + td + td + td + td + td + td  {
 color: red
 }

, , , css datepicker css ot it

0

All Articles