html set data attribute to div code example
Example 1: javascript get data-id attribute
//get data-id attribute in plain Javascript
var element = document.getElementById('myDivID');
var dataID = element.getAttribute('data-id');
//get data-id using jQuery
var dataID = $('myDivID').data('data-id');
Example 2: data attribute html
<!-- data-* attritubes can be used on any html element -->
<div data-my-custom-data="true"></div>