-1

In the code I am working on I found this:

<div class="icon icon2  screen-icon" data-screen-idx=1>

What puzzles me is the last "attribute" (or whatever it is ) Is this data-screen-idx-1 legal in html tag? Please note that 1 is not quoted.

If yes, where can I find info about this. If not, why would someone write such thing?

Hairi
  • 3,318
  • 2
  • 29
  • 68

1 Answers1

0

Yes, this is valid HTML. They are called "data-attributes" and can be whatever you want, as long as they begin with data-.

See this article for more information. MDN - Using data attributes

andrewmenich
  • 101
  • 2