03.11.2019, 09:05
(02.11.2019, 18:12)buuuudzik Wrote: You have a typo, add a dot before a "icanvas2" if this is a className:
Code:const cvs = document.querySelector(".icanvas2")
I have tried with this, well as you said, this is a className ".icanvas3", that is in code I add a dot:
const cvs = document.querySelector(".icanvas3")
console.log(cvs);
const ctx = cvs.getContext("2d");
console.log(ctx);
ctx.moveTo(0,0);
ctx.lineTo(200,100);
ctx.stroke();
even so, it doesnt work, console.log(ctx), its result is NULL
best regards