Data attributes is there a limit on the length and how much?

Is there a limitation on the html data attribute? Is it possible to have many data attributes in a tag?

ex. data-a="" data-b="" data-c="" ... data-z=""

And also is there a limit on the duration of the value for each data attribute?


source to share

2 answers

Each HTML element can contain any number of custom data attributes with any value.

Source: Embedding custom invisible data with data- * attributes

The length limit was discussed in a previous question linked to Mary Melody above: Is there a limit on the length of HTML attributes?



Most of my concern. They don't have a maximum length when defining a data attribute in JavaScript, just remember to always use lowercase letters[-variable]



All Articles