I´m working on a for that create HTML elements than insert them into my page dinamically.
for (let i = 0; i < 26; i++) {
var res2 = document.getElementById("res2")
var divCriada = document.createElement("div")
divCriada.className = "divname"
divCriada.innerHTML = "abc"
res2.appendChild(divCriada)
var input = document.createElement("input")
input.className = "input"
let divInserida= document.getElementsByClassName("divname")
divInserida[i].appendChild(input)
var br = document.createElement("br")
res2.appendChild(br)
}
Notice that, the code is doing exactly what it was made for:
https://i.stack.imgur.com/iI5lk.png
All 26 divs are being created correctly, but the line break just don´t work! you can see right ahead!
https://i.stack.imgur.com/974lD.png
I don´t know what to do, i don´t find any answer anywhere =(
i´m new to this world, maybe it could be a gross mistake by me, but if you find it i would aprecciate a lot if you explain what you did and why mine is not working.
Maybe you can add CSS Style on #res2
#res2 {
display: flex;
flex-direction: column;
}