Topic: How to add click event to calendar ?
Yohana Habsari premium asked 4 years ago
*Expected behavior*i want to redirect user to the page of the calendar item
*Actual behavior*nothing happen, just a tooltip
Resources (screenshots, code snippets etc.)** calendar plugin from MDB 5 **
Yohana Habsari premium answered 4 years ago
$('.fc-day-grid-event').on('click', () => { console.log('click') })
how we add the class .fc-day-grid-event? at initialization?
Mikołaj Smoleński staff commented 4 years ago
You're almost correct. Each event has a class event
so it should be:
$('.event').on('click', () => { console.log('click') });
or in Vanilla JS:
document.getElementsByClassName('event').forEach((event) => {
event.addEventListener('click', () => {
console.log('click');
});
});
Best regards
Yohana Habsari premium commented 4 years ago
thank you for your help
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- ForumUser: Premium
- Premium support: Yes
- Technology: MDB Standard
- MDB Version: 1.0.0
- Device: desktop
- Browser: mozilla
- OS: windows
- Provided sample code: No
- Provided link: Yes