Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to call events on clicking prev and next button?

In jQuery fullcalendar we have previous and next buttons. How can we call some events on click of these buttons?

like image 543
Neo Avatar asked Jul 22 '11 10:07

Neo


3 Answers

The best way is:

viewRender: function(view, element) {
  var b = $('#calendar').fullCalendar('getDate');
  alert(b.format('L'));
},
like image 99
Burak Ogutken Avatar answered Nov 16 '22 16:11

Burak Ogutken


You couldsimply attach an event to the button:

$('.fc-button-prev span').click(function(){
   alert('prev is clicked, do something');
});

$('.fc-button-next span').click(function(){
   alert('nextis clicked, do something');
});
like image 35
Nicola Peluchetti Avatar answered Nov 16 '22 16:11

Nicola Peluchetti


This worked for me:

$('body').on('click', 'button.fc-prev-button', function() {
  //do something
});

$('body').on('click', 'button.fc-next-button', function() {
  //do something
});
like image 18
streak Avatar answered Nov 16 '22 17:11

streak