vkurko/calendar

Today button not being called on .ec-button class

steveb85 opened this issue · 3 comments

Adding a function on event listener for .ec-button works for all buttons except the today button, which seems to go into disabled before the event listener receives it.

Haven’t been able to find any work around and have had to remove the button for now!

Otherwise loving it, thanks

With event delegation it works:

const el = document.getElementById('ec');
const ec = new EventCalendar(el, {
  view: 'timeGridWeek'
});

el.addEventListener('click', function (e) {
  console.log(el.contains(e.target.closest('.ec-button')));
});

I hope I can close this issue.

Thanks, this worked for me!