javascript - Full calender - Remove Events on day click and remove Bg-color of particular cell -
i need limit events 1 in particular date, , on click of date if events present, has removed.
while adding event date, color of cell should turned orange, , while deleting event, has turned white.
$(function () {
// full calendar var date = new date(); var d = date.getdate(); var m = date.getmonth(); var y = date.getfullyear(); var calendar = $('#calendar').fullcalendar({ header: { left: 'prev,next today', center: 'title', right: 'month,agendaweek,agendaday' }, selectable: true, selecthelper: true, select: function(start, end, allday) { var title = prompt('event title:'); if (title) { calendar.fullcalendar('renderevent', { title: title, start: start, end: end, backgroundcolor: 'orange', allday: allday, }, true ); } calendar.fullcalendar('unselect'); }, eventclick: function(event){ var r=confirm(\"are sure?\"); if (r==true) { $('#calendar').fullcalendar('removeevents',event._id); } }, dayclick: function(date, allday, jsevent, view) { if($( ).hasclass('bg-orange')){ $(this).removeclass('bg-orange'); } else { $(this).addclass('bg-orange'); } }, editable: true, events: [ ] }); });
Comments
Post a Comment