const elements = document.getElementsByClassName("grid-item"); const text = " działaj kurwo proszę" for (const element of elements) { const child = element.children[0] element.addEventListener("click", function () { for (const letter of text) { setTimeout(function () { child.innerHTML += letter }, Math.floor(Math.random() * 1000) + 500) } }) }