How to write a script to load images?

There is a Div with the class "images" which are link and image.
Trying to write a script to upload all images.
for(let i=0;i<(document.querySelector('.images').childElementCount);i++){
 if(document.querySelector('.images').children[i].tagName == 'A'){
document.querySelector('.images').children[i].setAttribute('download',document.querySelector('.images').children[i].getAttribute("value"));
document.querySelector('.images').children[i].click();
}
}

The problem is that not all unloaded images.
How can I fix it?
March 23rd 20 at 19:35
3 answers
March 23rd 20 at 19:37
Maybe you messed in the selector. Assuming those images are not unloaded, he just doesn't satisfy.
March 23rd 20 at 19:39
but querySelectorAll
March 23rd 20 at 19:41
Code redundant to 250%.

try querySelectorAll.
a better piece where looking for, apply.
however, when you apply, you'll see for yourself)))

Find more questions by tags JavaScript