1
votes

I'm using FullCalendar plugin in order to show daily calendar. When the user clicks on an event I want to get the calendar event id. I did that by the FullCalendar click event:

$('#calendar').fullCalendar({
    ...
    eventClick: function(calEvent, jsEvent, View)
    {
        console.log(calEvent.id);    
    }
});

I want to get the same event id by using JQuery events:

$('.fc-event').on('click', function(){
    console.log(...) //How do I get the the FullCalendar event id?
});

I'm very flexible in what way to do that - Get the id from the .fc-content with JQuery or bind some id in the events themselves and then show it when needed.

Thanks a lot!

1

1 Answers

0
votes

I found a solution to my problem. Bind the id when the calendar events are rendered:

$('#calendar').fullCalendar({
    ...
    eventRender: function(event, element)
    {
        element.find('.fc-content').attr("id", event.id);    
    }
});

And then you can use JQuery events by the id attr

$('.fc-content').on('dblclick', function(){
    console.log($(this).attr("id"));
});