How to get calendar event id when clicking on event?


Topic: How to get calendar event id when clicking on event?

quretec pro premium priority asked 2 years ago

Expected behavior

Using calendar as read-only. Want to navigate user to custom event page. Get custom event id when clicking on event.

Actual behavior

Unable to link to id.

Resources (screenshots, code snippets etc.)

https://mdbootstrap.com/support/standard/how-to-add-click-event-to-calendar/ specifies how to add on click event.

document.getElementsByClassName('event').forEach((event) => {
  event.addEventListener('click', () => {
    console.log('click');
    // event.id does not work
    // how to get the custom attribute id?
  });
});

https://mdbootstrap.com/docs/standard/plugins/calendar/#section-custom-attributes specifies assigning custom id to event.


kpienkowska staff answered 2 years ago

QuretecDev pro premium priority answered 2 years ago

Thank you, works nicely!


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
  • User: Pro
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 4.3.0
  • Device: desktop
  • Browser: Firefox
  • OS: Windows
  • Provided sample code: No
  • Provided link: Yes