问题在Fullcalendar中插入模态的代码

I am testing Fullcalendar and it can read events fine from database. Now I am trying to include some code I found for making a modal to insert new events in Fullcalendar. No matter what I do, the calendar stops rendering?

I found a code from JSfiddle that looks really good: https://jsfiddle.net/milz/fotLoLy9/

And here is my code I am using:

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

    var calendar = new FullCalendar.Calendar(calendarEl, {
          schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source',
      plugins: [ 'interaction', 'dayGrid', 'timeGrid', 'resourceTimeline' ],
      now: '<?php echo date("Y-m-d"); ?>',
      editable: true,
      aspectRatio: 1.8,
      scrollTime: '00:00',
      header: {
        left: 'today prev,next',
        center: 'title',
        right: 'resourceTimelineDay,resourceTimelineThreeDays,timeGridWeek,dayGridMonth'
      },

      defaultView: 'resourceTimelineDay',
      views: {
        resourceTimelineThreeDays: {
          type: 'resourceTimeline',
          duration: { days: 3 },
          buttonText: '3 days'
        }
      },
      resourceGroupField: 'building',
      resources: [
        { id: 'a', building: 'One', title: 'A' },
        { id: 'b', building: 'One', title: 'B', eventColor: 'green' },
        { id: 'c', building: 'One', title: 'C', eventColor: 'orange' },
        { id: 'e', building: 'One', title: 'D' },
        { id: 'i', building: 'Two', title: 'Extra' }
      ],
      events: 'load.php',

    });

    calendar.render();

  });

I want to combine those two codes, but when I try, the calendar stops rendering. So, there is just a blank page as a result. I dont know how to see error messages? For php, the error log tells me whats wrong. But this isnt showing in error log..