1

I'm very new to JQuery, so please excuse my lack of experience that I most surely will demonstrate within this question. So far I've coded a calendar that changes the colors of a particular day's box in the calendar.

What I want to be able to do is have the particular day's box change back to white if it is selected again. The problem is, I don't really understand the dayClick function as a whole. I tried making a similar function called dayUnClick, which was identical aside from the assigned color, but it didn't work.

Picture of Code

Michela
  • 59
  • 7

1 Answers1

1

You can do this very simply using a class:

$("calendar").fullCalendar({
    dayClick: function (date, jsEvent, view) {
        if ($(this).hasClass("clicked")) {
            $(this).css("background-color", "white");
            $(this).removeClass("clicked");
        } else {
            $(this).css("background-color", "pink");
            $(this).addClass("clicked");
        }
 });
Cameron637
  • 1,699
  • 13
  • 21