FullCalendar

Adam Shaw

dayClick

Triggered when the user clicks on a day.

function( date, jsEvent, view ) { }

date holds a Moment for the clicked day. If an all-day area has been clicked, the moment will be ambiguously-timed. If a slot in the agendaWeek or agendaDay views has been clicked, date will have the slot's time.

jsEvent holds the native JavaScript event with low-level information such as click coordinates.

view is set to the current View Object.

Within the callback function, this is set to the <td> of the clicked day.

Here is an example that demonstrates all of these variables:

$('#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');

    }
});

 

Latest News

Support FullCalendar