5
votes

I am trying to change the color of the selected cell every time I click on cell of agendaWeek view I want to change its color.

For Example: If I click on date 22 then I want to change its background color BUT when I again click over date 23 then the background color of the CELL should be changed and the cell of Date 22 should be plain as other dates.

In short, I want to change the selected date color in the Full Calendar.

Thanks

1
What you tried so far? Show your code snippet.Siva Charan
almost everything but simply that particular lines are changing background of the selected cell but when I click another cell then its color also changed dayClick: function(date, allDay, jsEvent, view) { $(this).css('background-color', 'red'); }Bilal
Ok then refer my answerSiva Charan

1 Answers

3
votes

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

JS:

var tempVar = "";
$('#calendar').fullCalendar({
    dayClick: function(date, allDay, jsEvent, view) {
        // change the day's 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;
        }


    }
});​

Refer LIVE DEMO