i add a javascript to catch user click on prev button (to get that month's data)
$(".fc-prev-button span").click(function(){
var view = $('#calendar').fullCalendar('getView');
console.log("The view's title is " + view.intervalStart.format());
console.log("The view's title is " + view.name);
return false;
});
but every time a user click, it will log 3 times, means on click on the button, 3 times call the function, if there is a way to just call 1 time?
or anyone has a better idea to deal with user click on the prev / next button?
i add a javascript to catch user click on prev button (to get that month's data)
$(".fc-prev-button span").click(function(){
var view = $('#calendar').fullCalendar('getView');
console.log("The view's title is " + view.intervalStart.format());
console.log("The view's title is " + view.name);
return false;
});
but every time a user click, it will log 3 times, means on click on the button, 3 times call the function, if there is a way to just call 1 time?
or anyone has a better idea to deal with user click on the prev / next button?
Share Improve this question asked Aug 13, 2015 at 11:06 ChanChan 1172 silver badges6 bronze badges2 Answers
Reset to default 7Better use built in events to get your data. You could listen to viewRender
and get your data like this:
$("#calendar").fullCalendar({
viewRender: function(view, element) {
console.log("The view's title is " + view.intervalStart.format());
console.log("The view's title is " + view.name);
}
});
view Render
Documentation
Probably this will avoid your problem.
Try to delete span in selector. May be that would help. There are three spans inside of the button...