Warisha Iqbal
Warisha Iqbal

Reputation: 67

How to use Custom button only for month view in JavaScript full calendar?

I added custom button in my JavaScript full calendar code but I want to show this button only month view.

$(document).ready(function() {

  var calendar = $('#calendar').fullCalendar({

    editable: true,
    //FOR HEADER

    header: {
      left: ' prev,next today ',
      center: 'title',
      right: 'month,agendaDay,agendaWeek,myCustomButton'
    },
    customButtons: {
      myCustomButton: {
        text: 'REPEAT FOR NEXT MONTH',
        click: function() {
          alert('my custom button');
        }
      }
    }

  });

});

Upvotes: 0

Views: 1749

Answers (1)

Afnan Ahmad
Afnan Ahmad

Reputation: 2542

If you need to append button for each day in a month view then you may use the following snippet:-

eventAfterAllRender: function(view) {

   if(view.name == 'month')
   {                       
       $('.fc-day').each(function(){
          $(this).append('<button>Day</button>');
       });      
    }
}       

Upvotes: 1

Related Questions