0
why we are have error
for(var i=0;i<100;i++){ var cell = document.createElement("div") cell.classList.add("cell") document.getElementsByClassName("board").appendChild(cell) } errooooooor: Uncaught TypeError: document.getElementsByClassName(...).appendChild is not a function
1 Réponse
+ 1
document.getElementsByClassName("board") is returns an array, not a single item, if "board" Class exists. So you can't apply appendChild to array of elements directly..