I want to be able to append a replay button on to my canvas when the player loses my javascript game.
I have HTML:
<canvas id="myCanvas" >
</canvas>
And part of my javascript:
var canvas = document.getElementById("myCanvas");
...
if (gameover){
var div = document.createElement('div');
div.innerHTML = '<button onclick="window.reload">replay</button>';
canvas.appendChild(div);
}
When I inspect my window the HTML has been added, but it doesn't show up on the screen?