<script lang="javascript"> function doSomething(e) { console.log(`You clicked <${e.target.localName}>`); // uncomment next line to stop it getting to href (and see the log above) // e.preventDefault(); } </script> <div onclick="doSomething(event)"> <a download href="/path-to-file"><strong>DOWNLOAD</strong></a> </div>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter