JS Error: Element is not attached to a Document

Try this:

html2canvas($("#phone")[0]).then((canvas) => {
    console.log("done ... ");
    $("#out_image").append(canvas);
});

The two changes are: pass the first element of the jquery selection to html2canvas, rather than the selection itself. That gets rid of the error … but for something to happen it seems that you need to treat the call as a Promise, rather than pass an onrendered callback (that’s the second change)

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top