JQuery Calendar (http://arshaw.com/fullcalendar/) How to change the selected cell background color

I try to change the color of the selected cell every time I click on the cell of the agenda view. I want to change her color.

For example: if I click on date 22, then I want to change its background color. BUT, when I click on date 23 again, then the background color of CELL should be changed, and the Date 22 cell should be as simple as other dates.

In short, I want to change the selected date color in full screen mode.

thank

+5
source share
1 answer

Well, you need to do something to handle this: -

JS:

var tempVar = "";
$('#calendar').fullCalendar({
    dayClick: function(date, allDay, jsEvent, view) {
        // change the day background color just for fun
        if (tempVar == "")
        {
            $(this).css('background-color', 'red');
            tempVar = this;
        }
        else
        {
            $(this).css('background-color', 'red');
            $(tempVar).css('background-color', 'white');
            tempVar = this;
        }


    }
});​

Contact LIVE DEMO

+3
source

All Articles