HTML5 Data Attributes: data-*

Data attribute provides to define custom data attributes in HTML5. Data attribute format is “data-*” that “*” means desired custom attribute name. This useful data attribute has very simple usage.

Example: If you need row index number of a table.

Foo Check index
Bar Check index

jQuery(document).ready(function() {
$(".to-see").click(function(e) {
var index = $(this).data("row-index");
if (index < 25) {

It would be before clicking check index:

After clicking check index, it would look like: