I'm trying to make a download button for my qr code generator app
downloadBtn.addEventListener('click', ()=>{
let imageWidth = qrImage.naturalWidth;
let imageHeight = qrImage.naturalHeight;
canvas.width = imageWidth;
canvas.height = imageHeight;
let canvas = document.createElement('canvas');
let a = document.createElement('a');
let ctx = canvas.getContext('2d');
ctx.drawImage(qrImage, 0,0, canvas.width, canvas.height);
a.href = canvas.toDataURL();
a.download = new Date().getTime();
a.click();
})
So i implemented that code, but still doesn't work
I want it to download the image source of my qr generator