I am building a custom WordPress block using ES5, and I have a function in the edit to get the canvas:
function imgclickHandler(event) {
myPics = document.getElementById('myPics');
context = myPics.getContext('2d');
isDrawing = true;
x = event.clientX;
y = event.clientY;
var coords = "X coords: " + x + ", Y coords: " + y;
//alert(isDrawing);
}
The code is failing to find myPics = document.getElementById('myPics');
the canvas in the HTML is coming out with the ID as myPics
, but I don't think the JavaScript is getting the element.