You can do the following between the tags a
you can put the text inside a span
with an identifier (in case I put the download class) and use the code to click from one to one, the problem is that the browser asks permission to download all the files at once.
<a href="http://www.petcidade.com.br/wp-content/uploads/2016/09/cachorro-tenta-pegar-petisco-imagem-1-reproducao.jpg" download="teste"><span class="download">teste1</span></a>
<script>
$('.download').trigger('click');
</script>
NOTE: The download attribute did not work for this link, but for a local file it worked in the test I did here!
Or you could do it that way here too:
$('a').each(function(i, el) {
window.location = $(el).prop('href');
});
That way you wouldn’t have to tag span
, but would not have control over the attribute download
.
Tries
$('.meuElemento').click()
– JuniorNunes
@Juniornunes7 I tried too, but it returns the element "<a>. refDownload"
– Bruno
Boy that strange, maybe it only works for one element and not several, tries to make a loop with all its elements and shoot the event one by one.
– JuniorNunes
@Juniornunes7 But that’s what I want to kkkk, download the files one at a time, but it didn’t work any of the above ways.
– Bruno
Okay, here in the comment it is difficult to put code, I will post a response with the code and you see if it will work for you, if it doesn’t work I delete.
– JuniorNunes
@Juniornunes7 All right, thank you in advance for trying to help.
– Bruno