Friday 15 March 2013

fullcalendar adding & removing events -



fullcalendar adding & removing events -

i'm trying adding & removing events clicking on them, works, if alter month, or add together 1 more event, not longer works.. not work properly:

$('#calendar').fullcalendar({ header: { left: 'prev,next today', center: 'title', right: 'month,basicweek,basicday' }, defaultdate: '2014-11-07', editable: true, eventlimit: true, // allow "more" link when many events events: [{ id: 'all day event', title: 'all day event', start: '2014-11-03' }, { id: 'popo', title: 'popo', start: '2014-11-04t10:30:00', end: '2014-11-04t12:30:00', description: 'this cool event', color: 'rgb(142, 67, 163)', textcolor: 'white' }, { id: 'popo2', title: 'popo2', //url: 'http://google.com/', start: '2014-11-05' }] }); $('.fc-day').click(function(){ var myprompt = prompt(''); /*$('#calendar').fullcalendar('addeventsource', [{ id: myprompt, title: myprompt, start: $(this).attr('data-date') }]);*/ var newevent = { id: myprompt, title: myprompt, start: $(this).attr('data-date') }; $('#calendar').fullcalendar( 'renderevent', newevent , 'stick'); }); $('.fc-content').click(function(){ var gugu = $(this).children('.fc-title').html(); $('#calendar').fullcalendar('removeevents', gugu); });

what i'm doing wrong?

demo here

instead of $('.fc-content').click(function(){ utilize $('#calendar').on('click','.fc-content',function(){

so work new dinamicaly created events too.

fullcalendar

No comments:

Post a Comment