I need assistance with appending an existing div (stored in the variable "parent") to a new div multiple times within my code. Below is the snippet of code I am working with. Currently, it appends the existing div to the last created div. Can someone help me resolve this issue?
var result = JSON.parse(xhr.responseText);
var rowCount = result.length;
var parent = document.getElementById("post-feed");
for(i = 0; i < rowCount; i++){
var newdiv = document.createElement("div");
newdiv.id = "post-id-"+result[i].postid;
newdiv.className = "row";
newdiv.appendChild(parent);
document.getElementById("feed").appendChild(newdiv);
document.getElementById("post-msg").innerHTML = result[i].message;
var image = result[i].image;
if(image != null){
document.getElementById("image").src = "uploads/"+image;
}