I'm sure there's only a few ways to do it, but this code is really similar to the one I wrote back in December: https://github.com/mikehodgson/minesweeper
It is playable here: https://sweeper.games
No jQuery, just straight CSS/HTML/ES6
It is playable here: https://sweeper.games
No jQuery, just straight CSS/HTML/ES6