Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how to get Different name for each td?

I need some help, what should I do so that all the rows have each one a different id for example:introdu1,introdu2,introdu3

var perrow = 1; 
array.forEach((value, i) => {

  myTable += `<td id="ore">${value}</td>`;
  myTable += `<td id="introdu" > </td>`;
  
  
  var next = i + 1;
  if (next%perrow==0 && next!=array.length) { myTable += "</tr><tr>"; }
});

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Use a dynamically generated ID:

var perrow = 1;
var id = 1;
array.forEach((value, i) => {

  myTable += `<td id="ore${id}">${value}</td>`;
  myTable += `<td id="introdu${id++}" > </td>`;

  var next = i + 1;
  if (next % perrow == 0 && next != array.length) {
    myTable += "</tr><tr>";
  }
});
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading