I'm trying to use canvas to draw a section of a dom elements background image to the canvas tag. Here is what I have right now.
var draw = function( data ){
var canvasStr = '<canvas id="highlight" width='300' height='200'></canvas>'
var canvasEl = $(canvasStr).appendTo( wrapper );
var context = canvasEl.get(0).getContext('2d');
var imgSource = wrapper.find('.invoice').get(0);
context.drawImage(imgSource, 0, 0, 300, 200);
}
It looks like its not able to read the imageSource from jquery directly. How would I go about this to make it work.