如何添加事件到日期在fullcalender上点击日期

问题描述:

我正在使用fullcalender。现在通过使用拖动选项将事件添加到日期。现在,我需要通过点击特定日期来添加事件。如何添加事件到日期在fullcalender上点击日期

有什么选择吗?

+0

你能告诉你有什么的问题,到目前为止,任何代码? (使用[编辑]按钮)。 –

我发现这个代码在documentation

$('#calendar').fullCalendar({ 
    dayClick: function(date, jsEvent, view) { 
     alert('Clicked on: ' + date.format()); 
     alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY); 
     alert('Current view: ' + view.name); 

     // change the day's background color just for fun 
     $(this).css('background-color', 'red'); 
    } 
}); 

编辑:dayClick是什么,我相信你正在寻找。

+0

这在点击活动时有效。我需要代码添加事件,同时点击特定日期 – sandeep

+0

@sandeep我道歉,我意识到我发布后一分钟左右。我已将我的答案更新为'dayClick'。 – NightOwlPrgmr

我发现这个代码在YouTube的Utphala教训:

$(document).on('click','.fc-day',function(){ 
    var date = $(this).attr('data-date'); 
    $.get('index.php?r=events/create',{'date':date},function(data){ 
    $('#modal').modal('show') 
     .find('#modalContent') 
     .html(data); 
    }); 
    });