for each to assign data id value code example
Example 1: set data-id javascript
var d = document.getElementById("test"); // Javascript
d.setAttribute('data-id' , 'Next'); //
Example 2: set data-id javascript
$('#test').attr('data-id' , 'Next'); // JQuery