Tic tac toe gamedeee

Tic tac toe gamedeee


i want that when i clicked the block, ‘O’ appears on the other block. But it appears only one time. I know that not solution, but i want understand how it works

		document.getElementById('game').onclick = function(event) {	
			var allBlock = document.getElementsByClassName('block');
			if (event.target.className == 'block') {
				event.target.innerHTML = 'X';
			for (var i = 0; i < 8; i++) {
				if (allBlock[i].innerHTML !== 'X') {
					allBlock[i].innerHTML = 'O';


I removed your duplicate question. To better help us, can you post a link to your entire code (html, css, and js)? Some use Codepen or JSFiddle. If not, then post each section in a single post.