JSFiddle - React, Tailwind, and code Playground
HTML
<div id="chess-board">
</div>
JavaScript
document.addEventListener("DOMContentLoaded", () => {
let field = document.getElementById("chess-board");
field.setAttribute("style","width:336px; border:1px solid black; height:336px;");
for (let i = 0; i < 8; i++) {
for (let k = 0; k < 8; k++) {
cell = document.createElement("div");
cell.setAttribute("style","width:40px;float:left; height:40px; border:1px solid black")
if((k + i) % 2 == 0)
{ cell.style.backgroundColor="#000000"}
field.appendChild(cell);
}
}
}
);