How To Appendchild(element) Many Times. (the Same Element)
My question is: Is that possible to add the same element without rewriting the same variable. I am creating a slider, and i need to append a div with a class slide-el into block sl
Solution 1:
appendChild will remove the node from wherever it is before appending it to its new location, so you need to make copies of the node instead. You can use cloneNode for that. The true makes cloneNode perform a deep clone, i.e. with all its child nodes.
for(var i = 0; i < urls.length; i++){
  sliderBody.appendChild(slide.cloneNode(true));
}
Post a Comment for "How To Appendchild(element) Many Times. (the Same Element)"