Working strange #2969
Unanswered
FranciscoColin
asked this question in
Q&A
Working strange
#2969
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am currently trying to download an image generated with html2canvas but the button that I assign the function to download the image to does not work unless I press this button 7 times, does anyone have an idea what could be going on?
this is how i call the function using a button
Descargar imagen
this is the function
const $boton = document.querySelector("#btnCapturar"),
$objetivo = document.body;
$boton.addEventListener("click", () => {
html2canvas($objetivo)
.then(canvas => {
let enlace = document.createElement('a');
enlace.download = "Registro.png";
enlace.href = canvas.toDataURL();
enlace.click();
});
});
Beta Was this translation helpful? Give feedback.
All reactions