I have a section in which I have multiple images now on click I would like to download all.
Here is what my images look like
and here is how I am downloading those images using jquery
HTML
<button onclick="downloadImages()">Download</button>
JS
function downloadImages(){
let link = $(".grcode-image");
console.log('link', link)
link.click();
}
When I click the download button only I see is the console log
What am I doing wrong here? and what do I need to do to be able to download all images at once?
CodePudding user response:
If you only need download the images without zip:
Just map the array and click:
function downloadImages() {
$(".grcode-image").each(function (index, currentElement) {
currentElement.click();
});
}