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
JavaScript
x
2
1
<button class="button" onclick="downloadImages()">Download</button>
2
JS
JavaScript
1
6
1
function downloadImages(){
2
let link = $(".grcode-image");
3
console.log('link', link)
4
link.click();
5
}
6
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?
Advertisement
Answer
If you only need download the images without zip:
Just map the array and click:
JavaScript
1
6
1
function downloadImages() {
2
$(".grcode-image").each(function (index, currentElement) {
3
currentElement.click();
4
});
5
}
6