Using html2Canvas , I can change body element to canvas in this fiddle ,
html2canvas(document.body, {
onrendered: function(canvas) {
document.body.appendChild(canvas);
}
});
but when I get div element by ID using this code ,
html2canvas($('#mainDiv'), {
onrendered: function(canvas) {
document.body.appendChild(canvas);
}
});
I can't change this div to canvas . How can I fix it ?
Once you ensure that jQuery is included in your jsFiddle
, rendering the element works as intended. Here's a demo.