I added the calendar to my asp.net mvc 2 application from here .
I want to pick the selected date where I am going to enter the event. How can I get selected date?
$('#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');
}
});
Use this code when you setup the plugin
$('#calendar').fullCalendar({
selectable: true,
select: function(start, end, jsEvent, view) {
// start contains the date you have selected
// end contains the end date.
// Caution: the end date is exclusive (new since v2).
var allDay = !start.hasTime() && !end.hasTime();
alert(["Event Start date: " + moment(start).format(),
"Event End date: " + moment(end).format(),
"AllDay: " + allDay].join("\n"));
}
});
<link href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.1.1/fullcalendar.min.css" rel="stylesheet"/>
<link href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.1.1/fullcalendar.print.css" rel="stylesheet" media="print"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.8.3/moment.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.1.1/fullcalendar.min.js"></script>
<div id="calendar"></div>
Please note that I have just included the options needed to answer your question.
For further information refer to the very good made plugin documentation.