I wrote an algorithm to count and reveal all adjacent tiles in minesweeper. However, when a tile is revealed and does not contain a mine, it displays zero. The adjacent mines do not get revealed. I certain that the issue is in my code but I'm unable to figure it out. I'm looking for some guidance.
screenshot illustrating what I described above. 
My code:
// Left Click
if (event.which === 1)
{
startTimer();
if(tile.classList.contains("mine"))
{
tile.classList.toggle("mine_hit");
smiley.classList.toggle("face_lose");
window.alert("Game Over. You lose!");
revealMines();
}
else
{
tile.classList.contains("hidden");
tile.classList.remove("hidden");
// Count and display the number of adjacent mines
var mineCount = 0;
var tileRow = tile.parentNode.rowIndex;
var tileCol = tile.cellIndex;
//alert (tileRow + "" + tileCol);
for (var i = Math.max(tileRow-1,0); i <= Math.min(tileRow+1,9); i++)
{
for (var j = Math.max(tileCol-1,0); j <=Math.min(tileCol+1,9); j++)
{
if(minefield.rows[i].tile[j].classList.contains("mine"))
{
mineCount++;
}
}
}
tile.innerHTML=mineCount;
if (mineCount==0)
{
//Reveal all adjacent tiles as they do not have a mine
for (var i = Math.max(tileRow -1, 0); i <= Math.min(tileRow +1, 9); i++)
{
for (var j=Math.max(tileCol -1, 0); j <=Math.min(tileCol+1,9); j++)
{
//recursive call
if (minefield.rows[i].tiles[j].innerHTML=="") handleTileClick(minefield.rows[i].tile[j]);
}
}
}
//checkCompletionLevel();
}
}
I have tried modifying the revealMines function but no success. I changed this line tile.innerHTML=mineCount to tile.classList.containst("Hidden")=tile.ClassList.toggle("tile_1"). But the game board display 1 in blue where the tile was clicked. I have looked up other minesweeper games to try and understand but no success.