I am trying to screenshot and download it to server, but I am still getting an error. It's using Wordpress by the way.
Uncaught (in promise) Provided element is not within a Document
jQuery:
<script>
$('#save').click(function(){
html2canvas($('#capture'),
{
onrendered: function (canvas) {
var a = document.createElement('a');
a.href = canvas.toDataURL("image/jpeg").replace("image/jpeg", "image/octet-stream");
a.download = 'somefilename.jpg';
a.click();
}
});
});
</script>