Friday, May 10, 2024
 Popular · Latest · Hot · Upcoming
14
rated 0 times [  17] [ 3]  / answers: 1 / hits: 33289  / 9 Years ago, fri, february 13, 2015, 12:00:00

Clicking a date on fullcalendar launches a modal '#view_event'. I want to get the date on which I have clicked. each date has the class '.fc-day' has an attribute data-date=2015-02-13. so I tried the following.



$(.fc-day).click(function(){
var fetchDate = $(this).data(date);
$(#displayDate).text(fetchDate);
});


'#displayDate' is a p element in the modal. The above code isn't working. What's wrong?


More From » jquery

 Answers
13

Don't use the classes to access the date. there are ways to get the date and below is one where you can do it when you initialize the calendar ,
Using that you can get the date , month and year separately.



    $('#calendar').fullCalendar({

dayClick: function(date, jsEvent, view) {
alert('Clicked on: ' + date.getDate()+/+date.getMonth()+/+date.getFullYear());
},

});

[#67844] Wednesday, February 11, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
skylerselenem

Total Points: 282
Total Questions: 101
Total Answers: 107

Location: Nicaragua
Member since Tue, Dec 8, 2020
3 Years ago
;