HTML5 data-*
attributes provide a convenient way to store data in HTML elements. The stored data can be read or modified using JavaScript
<div data-submitted="yes" class="user_profile">
… some content …
</div>
Data attribute structure is data-*
, i.e. the name of the data attribute comes after the data-
part. Using this name, the attribute can be accessed.
Data in string format (including json
) can be stored using data-*
attribute.