How to appendChild(element) many times. (The same element)

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));
}

Solution 2:

Okey guys! I found an answer. I have to put

slide = _createEl("div");
slide.className += "slide-el";

into for loop. Now it looks like this:

for(var i=0; i < urls.length; i++){
  slide = _createEl("div");
  slide.className += "slide-el";
  sliderBody.appendChild(slide);
}