Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
I have asked this question to Andrew--the JQuery instructor. If I get his answer, I will post it here.
In the JQuery's simple drawing app, this line of code: var context = $canvas.getContext("2d"); always complaints that getContext is not defined.
Even I used jquery 2.1.1., the problem still exists. If I comment out this line of code, then it compiles.
$canvas is a jQuery object, not the actual canvas element. Accessing the 1st element (index 0) of this jQuery object will get you the canvas element
I'm not sure if this was omitted from the video but it seems to be in the downloadable project files.
var context = $canvas.getContext("2d");
That's why. Thanks for your clear explanation.