14 lines
501 B
JavaScript
14 lines
501 B
JavaScript
<script>
|
|
// Function to handle download
|
|
function handleDownload() {
|
|
// Get the download link element
|
|
var downloadLink = document.getElementById('download-link');
|
|
// Get the image source URL
|
|
var imageUrl = downloadLink.querySelector('img').src;
|
|
// Set the download link href to the image source URL
|
|
downloadLink.href = imageUrl;
|
|
}
|
|
|
|
// Add event listener to the download link
|
|
document.getElementById('download-link').addEventListener('click', handleDownload);
|
|
</script> |