When creating elements dynamically, pagination does not work, in the code I used bootstrap pagination

Question: how to initialize elements in DOM ?

  1. Add. link to the planer code
  2. An example was taken here

The algorithm when you click the "add" button is added to the row in the table.

If the table is static html then there is pagination with numbering (it works fine), but in my case the rows in the table are added dynamically by pressing a button and in this case there is no numbering, that is, the elements that did not exist in the DOM from the very beginning of the script (see the link under item 2, it is also present in my code) for the table does not see them of these elements

 document.querySelector('#createD').onclick = function() { var htb = document.getElementById('htb'); var row = document.createElement("div"); row.className = "t-row"; row.innerHTML = "<div class='col-1'><input class='checkbox' type='checkbox' name='domename'></div>" + "<div class='col-2'><div><i class='site-ico'></i><a href='#' class='domen-name'>www.example</a></div></div>"; tba.insertBefore(row, null); }, document.querySelector('#removeD').onclick = function() { var row = document.getElementsByClassName('t-row'); var domename = document.getElementsByName('domename'); for (i = 0; i < domename.length; i++) { if (domename[i].checked) { var remElm = domename[i]; var tba = document.getElementById("tba"); remElm.parentNode.removeChild(remElm); tba.removeChild(row[i]); } } } 
  • And where is the description of the required functionality? What is this canvas code? Do you think someone wants to deal with this sheet without a description? - VenZell
  • VenZell, I'm sorry I'm doing in a hurry. Everything is clear there. - Radik
  • Videllell rightly says - no one will understand this pile. Need a minimal example. - user207618
  • "Other", then I ask you not to answer, go past. - Radik
  • So I did not answer. And with such an attitude towards trying to set you on the path of True, you are unlikely to earn the desire to help you with anyone. - user207618 2:49 pm

0