prop() in jquery to add data code example
Example 1: jquery set data attribute value
//<div id="myElementID" data-myvalue="37"></div>
var a = $('#myElementID').data('myvalue'); //get myvalue
$('#myElementID').data('myvalue',38); //set myvalue
Example 2: jquery get data attribute
<a data-id="123">link</a>
var id = $(this).data("id"); // Will set id to 123