Fullcalendar select and unselect days

369 views Asked by At

I am working with a fullcalendar and the idea is: When I click on a day, it is saved in the database. After It must load the calendar with the saved selections and according to of certain conditions It must allow the selection or unselection of the days. My problem begin: when I select one day or multiple days and then I select another day, I lose the previous selection and I must keep it, as well as according to certain conditions enable or not a day to be selected or unselected. I am using version 5.3.2.I tried solutions of other questions but I suppose because of the version they do not work I would appreciate any suggestions. This is my code:

    document.addEventListener('DOMContentLoaded', function() {
          var calendarEl = document.getElementById('calendar');

          var calendar = new FullCalendar.Calendar(calendarEl, {
            selectable: true,   
            unselectAuto: false,
            headerToolbar: {
              left: 'title',
              right: 'prev,next',
            },
            dateClick: function(info) {
                $(".fc-highlight").css("background", "green");
            },
            select: function(info) {
              $(".fc-highlight").css("background", "green");
            }
          });

          calendar.render();
    });
0

There are 0 answers