set value to data-id attribute 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