How can I copy all elements and dublicate it? For example:
else if (event.keyCode == 84) {
var arr = document.querySelectorAll('.selected');
if(arr.classList.contains('selected')) {
for (var i = 0; i < arr.length; i++) {
var cln = arr[i].cloneNode(true);
var content = document.getElementById("content");
content.appendChild(cln);
console.log(cln.length);
}
}
}
Solved. Problem was var cln = arr[i].cloneNode(true); after removing [i] it started to work.
Comments
Post a Comment