This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Using API canvas HTML
#8
(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
Reply


Messages In This Thread
Using API canvas HTML - by batistacaceres - 27.10.2019, 20:09
RE: Using API canvas HTML - by buuuudzik - 27.10.2019, 22:39
RE: Using API canvas HTML - by batistacaceres - 02.11.2019, 07:37
RE: Using API canvas HTML - by buuuudzik - 02.11.2019, 08:24
RE: Using API canvas HTML - by batistacaceres - 02.11.2019, 17:17
RE: Using API canvas HTML - by buuuudzik - 02.11.2019, 18:12
RE: Using API canvas HTML - by batistacaceres - 03.11.2019, 09:05
RE: Using API canvas HTML - by batistacaceres - 03.11.2019, 12:25
RE: Using API canvas HTML - by DGrandes - 05.11.2019, 15:51
RE: Using API canvas HTML - by Joep - 05.11.2019, 12:48
RE: Using API canvas HTML - by Joep - 05.11.2019, 16:06

Forum Jump: