+ 1
Its giving error..saying context is not defined..any clue friends.??
var canvas=$("#canvs"); var context=canvas.get(0).getContext("2d"); context.fillRectangle(40,30,100,120);
7 odpowiedzi
+ 1
@jose but it still have same issue
+ 1
@jose hey not working..same error
+ 1
I have copied and pasted in q&a from playground..lhave tried it lot but can't understand what's wrong.included needed SRC in HTML for both js and jquery ...
+ 1
error now showing. can not read property getContext of null???
0
don't use the # for the id up there
0
try this way
var context = $("#canvs")[0].getContext('2d');
0
maybe it's another typing error or something else that you're forgetting. try getting context following a step-by-step, then see if it works