I want to change the text that is on a canvas. The problem that it is just adding and not removing letters as I delete them from the input.
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
window.change = function(val){
ctx.restore();
ctx.font = "20px Georgia";
ctx.fillText(val, 10, 50);
ctx.save();
}
<canvas id="myCanvas"></canvas>
<input type="text" onkeyup="change(this.value)" />
Why adding text working and removing is not working. can you please correct that?
Thanks