vkurko / calendar

Full-sized drag & drop JavaScript event calendar with resource & timeline views
https://vkurko.github.io/calendar/
MIT License
969 stars 82 forks source link

Today button not being called on .ec-button class #201

Closed steveb85 closed 7 months ago

steveb85 commented 7 months ago

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

vkurko commented 7 months ago

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')));
});
vkurko commented 7 months ago

I hope I can close this issue.

steveb85 commented 7 months ago

Thanks, this worked for me!