I have such a question today.
I have a function that creates rows in a table using a loop. That is, the function receives the number of lines, and the function loops to create the lines. But these lines need to be added, just in turn already in the existing table, in the middle. Here is the function code.
function genTr(count) { for (var i = 0; i < count; i++) { var tr = document.createElement('tr'); tr.setAttribute('id', 'tr' + i + '_'); if (i == 0) { $('#tr' + i + '_').insertAfter("#oldtr"); } else { $('#tr' + i + '_').insertAfter('#tr' + (i-1) + '_'); } } id - #oldtr - a row in the table, after which it is necessary to insert rows into the trick.
There is nothing in the inspector, lines are not inserted! Maybe there is a solution? Thank you very much!