Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: How to add click event to calendar ?

Yohana Habsari priority 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 priority 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 priority commented 4 years ago

thank you for your help



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: 1.0.0
  • Device: desktop
  • Browser: mozilla
  • OS: windows
  • Provided sample code: No
  • Provided link: Yes