Topic: HTML in calendar events

O1ivier priority asked 3 years ago

Hello !

I want to use the calendar with icons in the events title. It seems like we can't properly use them because the HTML is rendering not well in month and week views. I created a snippet so you can see the issue.

Is there a way to include icons in the events ?

Thank you.

Best regards

Dawid Wajszczuk staff commented 3 years ago

Hi. I can't open your snippet. Maybe you made it private or simply forgot to save it :) Can you please check it and fix this? This snippet will help a lot. Thanks.

O1ivier priority commented 3 years ago

Hmm, I tried to click on "Publish". The snippet still exist, it's public and I can open it. Can you retry ?


O1ivier priority commented 3 years ago

And another question, is it possible to define custom attributes for the events like my own ID or something else ?

Thank you

Dawid Wajszczuk staff answered 3 years ago


Your snippet works fine now. It was just some temporary issue :) Unfortunately icons can't be added due to how the plugin is rendered.

As for custom attributes, they also can't be defined. But events have data-mdb-event-key="number" attribute. This should work as unique ID. I hope that this will help you.

Keep coding,

O1ivier priority commented 3 years ago

Hello ! Thank you for your answer. However, can you explain me how can I define the data-mdb-event-key directly in Javascript and not in HTML ?

Dawid Wajszczuk staff commented 3 years ago

Hi. It is auto-generated with event render. It can't be defined. You can get its value with document.querySelector('.event-1').getAttribute('data-mdb-event-key'). Here is the snippet

Please insert min. 20 characters.


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



Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 3.8.0
  • Device: PC
  • Browser: Chrome
  • OS: Windows
  • Provided sample code: No
  • Provided link: No