Global Attributes
HTML data-* attribute
Stores author-defined data on an HTML element. Replace the asterisk with a lowercase name such as data-product-id. JavaScript exposes matching names through dataset; do not store secrets. Applicability: global HTML attribute, subject to element-specific restrictions and browser support.
Formal Syntax & Structure
html syntaxhtml
data-product-id="42"Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| data-* | custom attribute name and string value | Stores author-defined data on an HTML element. Replace the asterisk with a lowercase name such as data-product-id. JavaScript exposes matching names through dataset; do not store secrets. |
Working Example
Example Snippethtml
<article data-product-id="42">Notebook</article>Browser Compatibility
Minimum supported versions across modern rendering engines
Chrome
7
Yes
Edge
12
Yes
Firefox
6
Yes
Safari
5.1
Yes
Checked desktop BCD snapshot: global data_attributes attribute. Versions denote the recorded start of support (≤ means at least that early), not a guarantee of all behavior. Unresolved mirror and preview rows omitted. Attribute support is distinct from the dataset API.
HTML Living Standard