2

I already saw some tools which stores some state or data inside element's attribute:

<div clicks="2" id="myDiv" class="some-class">

but it's invalid in some doctypes.

At all. Is this a good solution for stateful elements? If not, some advice will be appreciated.

Thanks in advance.

pylover
  • 7,075
  • 8
  • 45
  • 72
  • Possible duplicate of http://stackoverflow.com/questions/2412645/whats-the-best-html-attribute-to-use-to-store-information-for-jquery-to-parse – Greg Jul 10 '13 at 23:20

1 Answers1

3

Under HTML5 you have the option to use, valid, data-* attributes, such as, in this case data-clicks to store user-defined data.

References:

David Thomas
  • 240,457
  • 50
  • 366
  • 401