Q:

Capture a div and save as jpeg

#cap is a div i want to capture. 
I used ctx.drawImage($('#cap').get(0),0,0,640,480);window.open(canvas.getDataURL('image/jpeg'));
got a Type error
and how do i send it to php to save as a.jpeg
UPDATE
http://jsfiddle.net/3qNJB/ is not working help html2canvas is not a function

A:

< DIV > elements cannot be drawn on canvas using  drawImage() method.Have a look at Html2Canvas library
Example:
 html2canvas(document.getElementById('DivToCapture'), {
      onrendered: function(canvas) {
         // document.body.appendChild(canvas);
       window.open(canvas.toDataURL('image/jpeg'));
     }
  });

Heres the Fiddle

