I have an image that I want the user to click on to be able to download ( save it ).
When currently clicked, the download box pops up with the image.jpg tag and lets the user save it.
I am using HTML:
<a href="folio/1.jpg" download><img src="folio/1.jpg"/></a>
This works well, but I have a lot of images, is there a way to use jQuery to do something like
jQuery(function($){
$("a").prop("href", "(this)")
});
to download the image without having to type it in twice so it looks like this:
<a href="" download><img src="folio/1.jpg"/></a>
I am trying to simplify the coding to make it easy to click on the image to
download it rather than to have to right click to save it.
Thanks for your help.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…