Duplicated Click events
Closed this issue · 3 comments
79137913 commented
Well...
When i load the monthly plugin on a div works ok, but if i load again the webpage (by ajax) and reinitialize the plugin on the same div (now empty because it was loaded by ajax) the plugin shows up correctly but when i click on any button the click event fires 2 times.
kthornbloom commented
Yeah, it's a known bug. Please see discussion here for a (hackish) workaround: #4
devlinhaines01 commented
Try removing the click events before reinitializing:
$(document.body).off('click', '#mycalendar .monthly-next');
$(document.body).off('click', '#mycalendar .monthly-prev');
$(document.body).off('click', '#mycalendar .monthly-reset');
$(document.body).off('click', '#mycalendar .monthly-cal');
$(document.body).off('click', '#mycalendar a.monthly-day');
$(document.body).off('click', '#mycalendar .listed-event');
79137913 commented
@devlinhaines01 Thank you!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
It works perfectly now!