On the HTML 5 “data” attribute

This attribute can not only contain text values, but any arbitrary JavaScript value, including arrays and objects. This is extremely useful for scoping and eliminating the need for global variables in the your application’s JavaScript.

Reference: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_data_attributes

Updated:

Comments