Easy Tutorial
❮ Att Img Loading Att Input Formaction ❯

HTML data-* Attribute

HTML Global Attributes

Example

Use the data-* attribute to embed custom data:


Browser Support

All major browsers support the data-* attribute.


Definition and Usage

The data-* attribute is used to store custom data private to the page or application.

The data-* attribute can be used on any HTML element to embed data.

Custom data can provide better interactive experiences without needing Ajax or querying the server.

The data-* attribute consists of two parts:

Note: The "data-" prefix for custom attributes is ignored by the client.


Differences Between HTML 4.01 and HTML5

The data-* attribute is new in HTML5.


Syntax

Attribute Values

Value Description
somevalue Specifies the attribute value (a string)

❮ Att Img Loading Att Input Formaction ❯