-1
I’m trying to create HTML tags that will each receive a different value from an array. For this I used innerhtml to create the content, but they are superimposed only on the first div.
var y =document.getElementById("carta");
for(var i = 0; i <data.length; i++ ){
console.log(y);
var x =document.createElement("div");
x.innerHTML= `
<h5 class="card-header">
${data[i].name}
</h5>
<div class="card-body">
<img src=${data[i].photo}
</div>
<div class="card-footer">
Preço: R$ ${data[i].price}
</div>
`
y.appendChild(x);
}