I have a loop that creates a button on the table I only show the part where I add the button. Now the thing is I want to change the button id="edit" to edit01, edit02, edit03 in which will be based on the data.length as the loops goes on.
var data = ["1", "2", "3", "4", "5"];
var tb = $('#tab_d')[0];
var content = "";
for (var i = 0; i < data.length; i++) {
content += '<tr>' + '<td>' + '<button id="edit">' + 'Edit' + '</button>' + '</td>' + '</tr>';
}
tb.innerHTML = content;
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table border="1" id="tab_d"></table>