Topic: How to add click event to calendar ?
Yohana Habsari pro 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 pro 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 pro 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
- User: Pro
- Premium support: No
- Technology: MDB Standard
- MDB Version: 1.0.0
- Device: desktop
- Browser: mozilla
- OS: windows
- Provided sample code: No
- Provided link: Yes