I have made simple example of using canvas and then I saw that my code doesn\'t work when I use jQuery selector.
Examples:
Javascript
You can use get function of jquery to retrieve canvas element.
var canvas = $('#myCanvas').get(0).getContext('2d');