Attributes - Post ID 289237

User 2726830 Photo


Registered User
3 posts

Hello,
I would like to known all the details about attributes I can add to an element. I can see many possibilities of adding attributes like "Data Href", "Data Html", "Data Target", "Data Position", and so on... Any clues where I can have an explanation about that, how to use it with details ? I searched in the forum, nothing. Thanks !
User 2885740 Photo


Registered User
60 posts

Hi Nico,

data-attributes are custom attributes you can add to any HTML Element. To read more about what they are, you could start here: https://developer.mozilla.org/de/docs/W … tes/data-*
and here: https://www.w3schools.com/tags/att_data-.asp

The Data-attributes you mentioned are all part of the Materialize framework. They are defined by the makers of that framework. It is not easy to learn how to use them, because they are not documented well.
An Example? When you have a picture element with the class “materialboxed” added to it, you could use the data-attribute “data-caption” – as described here, under paragraph “Captions”: https://materializecss.com/media.html
When you give an element the class “materialboxed” an eventhandler is added to it. Now, when you click on the picture the correct piece of javascript is called to blend in the value of the “data-caption”.

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.