My calendar initialize with events from ajax-php script. The events has a simple css class with green background-color for available events and red background-color for not available events.

I need that when I click on a green event, it will turn red to set this not available.

var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
    plugins: ['timeGrid'],
    defaultView: 'timeGridWeek',
    minTime: '08:00:00',
    maxTime: '18:00:00',
    allDaySlot: false,
    weekends: false,
    defaultDate: jdata.defaultDate,
    contentHeight: 'auto',
    locale: 'es',
    eventClick: function (info) {
        var dia = moment(info.event.start).format("DD/MM/YYYY");
        var hora = moment(info.event.start).format("HH:mm");

        if (info.event.classNames[0] == 'completo') {

        reservarSala(info.event, sala_id);

1 Answers

Cybernetic On Best Solutions

The documentation says the HTML element for the event can be accessed using el:

var check_color =

if(check_color == “green”) { = “red” 
} else { = “green”