简体   繁体   中英

Uncaught TypeError: Cannot read property 'fullCalendar' of undefined

Hi I'm using fullCalendar jQuery plugin. This code is written based on https://www.drupal.org/node/1345028#comment-5258592

I got issue:

Uncaught TypeError: Cannot read property 'fullCalendar' of undefined

What's wrong? Why this chaining doesn't work?

I wanted to make when user clicks on a day (dayClick), go to arbitrary date (gotoDate) and changes view (changeView)

$(document).ready(function(){
    $('#calendar').fullCalendar({
      header: 
      {
        center: 'month,basicDay'
      },
      defaultView: 'month',
      dayClick: function(date, allDay, jsEvent, view){
// here what's wrong ↓            
           $('#calendar').fullCalendar('gotoDate', date).fullCalendar('changeView', 'basicDay');



      }
    });
});

I belive your second call to fullCalendar in line below causes this

$('#calendar').fullCalendar('gotoDate', date).fullCalendar('changeView', 'basicDay');

Maybe try this or something similar:

$('#calendar').fullCalendar('gotoDate', date);
$('#calendar').fullCalendar('changeView', 'basicDay');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM