GetElementByTag("canvas")is not not defined error..plz help... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

GetElementByTag("canvas")is not not defined error..plz help...

var canvs=getElementsByTag("canvas"); var context=getContext("2d"); context.beginPath(); context.arc(39,30,50,Math.pi*2,Math.pi*2,false ); context.closePath(); context.fillStyle="rgb(250,30,30)";

19th Mar 2017, 3:32 PM
suraj pandey
suraj pandey - avatar
2 Answers
+ 2
When you are selecting you canvas element, using the method "getElementsByTag", you forgot to tell JS in which object the method applies. var canvas = document.getElementsByTag("canvas") or var canvas = body.getElementsByTag("canvas")
19th Mar 2017, 3:46 PM
Nicolas Bonnet
Nicolas Bonnet - avatar
+ 2
I'll try this...thnx @nicolas
19th Mar 2017, 5:17 PM
suraj pandey
suraj pandey - avatar