Adding a second click event to <a href> - Stack Overflow

PHOTO EMBED

Thu Apr 01 2021 20:04:28 GMT+0000 (Coordinated Universal Time)

Saved by @JPFotoz #html

<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>
content_copyCOPY

https://stackoverflow.com/questions/66862120/adding-a-second-click-event-to-a-href?noredirect