Search code examples
javascriptjqueryjquery-pluginsfullcalendarfullcalendar-scheduler

How can I render "day click" event when clicked on "Event Click" in Jquery full calendar?


In jquery calendar,we have day click and event click. I am looking to render "day click" only even if the "event" is clicked. I commented the event click in my code to render "day click".Even though On click of the events in that day it's not firing anything. So How can I achieve it?Any suggestions appreciated

Here is sample code

 $('#calendar').fullCalendar({
  allDaySlot: false,
  header: {
    left: 'today prev next',
    center: 'title',
    right: 'agendaWeek,agendaDay'
  },
 //I commented this event click as I don't want
  eventClick: function(calEvent, jsEvent, view) {

  },
  dayClick: function(date, jsEvent, calEvent) {
      //my customized code
    }

Solution

  • You can call the same function from eventClick and dayClick. for example:

    eventClick: function(calEvent, jsEvent, view) {
        doSomething(calEvent.start);
    },
    
      dayClick: function(date, jsEvent, calEvent) {
          doSomething(date);
      })
    

    you can use the event object documentation here and the dayclick event document enter link description here.

    hope that helps.

    Paras