6

Is there a limit on html's data-attribute? Is it possible to have many data-attributes on a tag?

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

And also is there a limit how long the value on each data-attribute?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
meetmahpuppy
  • 418
  • 1
  • 4
  • 17
  • similar question - http://stackoverflow.com/questions/1496096/is-there-a-limit-to-the-length-of-html-attributes – Anonymous Sep 11 '14 at 16:43
  • Possible duplicate of [Is there a limit to the length of HTML attributes?](https://stackoverflow.com/questions/1496096/is-there-a-limit-to-the-length-of-html-attributes) – Fiddles Aug 11 '17 at 19:17

2 Answers2

4

Every HTML element may have any number of custom data attributes specified, with any value.

Source: w3.org: 3.2.5.9 Embedding custom non-visible data with the data-* attributes

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

Community
  • 1
  • 1
Iain
  • 131
  • 1
  • 11
0

Far of my concern. Their is no max length when defining data attribute in JavaScript just remember to always use lowercase [-variable]

ata
  • 3,398
  • 5
  • 20
  • 31
john lito
  • 1
  • 1