Custom Data Attributes allow you to add your own information to tags in HTML. Even though the name suggests otherwise, these are not specific to HTML5 and you can use the data-* attribute on all HTML elements.
The data-* attributes can be used to define our own custom data attributes. It is used to store custom data in private to the page or application.
There are mainly 2 parts of the Data Attributes:
- Attribute Name: Must be at least one character long, contain no capital letters and be prefixed with ‘data-‘.
- Attribute Value: Can be any string.
<li data-book-author="Rabindra Nath Tagore"> Gitanjali </li>
When we click on the book, we can see the name of the author in a separate dialogue box.
Supported Browsers: The browser supported by title attribute are listed below:
- Internet Explorer
- HTML | Id Attributes
- HTML | Attributes
- HTML | DOM attributes Property
- HTML | Attributes Complete Reference
- XML | Attributes
- jQuery | Get Content and Attributes
- jQuery | Set Content and Attributes
- HTML | <data> Tag
- HTML | data Attribute
- HTML | DOM Object data Property
- HTML | DOM InputEvent data Property
- HTML | <object> data Attribute
- GRE Data Analysis | Distribution of Data, Random Variables, and Probability Distributions
- GRE Data Analysis | Numerical Methods for Describing Data
- Difference between data type and data structure
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.