jquery clear canvas code example
Example 1: resetting canvas html
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.clearRect(0, 0, canvas.width, canvas.height);
Example 2: clear canvas content jquery
//set a const for all the code
const context = canvas.getContext('2d');
//to clear the canvas use:
context.clearRect(0, 0, canvas.width, canvas.height);
//if the canvas is with 300 and height 450:
context.clearRect(0, 0, 300, 450);