I am trying to screenshot and download it to server, but still getting error. It´s a Wordpress BTW.
Uncaught (in promise) Provided element is not within a Document
jQuery
<script>
function takeScreenshot(){
var element = jQuery("#vpc-preview");
html2canvas(element,{
background:'#FFFFFF',
onrendered:function(canvas){
var imgData = canvas.toDataURL('image/jpeg');
$.ajax({
url:'/wp-content/plugins/html2canvas/save.php',
type:'post',
dataType:'text',
data:{base64data:imgData}
});
}
});
}
</script>
Any help?
element
in your code is a jQuery object, not an element
Try
var element = jQuery("#vpc-preview")[0];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With