Wix/Velo: How to prevent a link to open while not altering the href?

On a wix site, we need to be able to not follow the target of the link when the user clicks it (as we do some JS things instead, i.e open an iframe).
Appending the iframe to the DOM and everything works well, the problem is that clicking on the link will run our code (great) AND follow redirect to the href, even though we e.preventDefault() on the click event.

For example, given the following link:

<a href="www.example.com">Click here</a>

We add an event listener for the click event and do:

(e) => {
  e.preventDefault();
  // Do our thing (show the iframe, etc)
}

How would you tackle this ?

We tried:

  • preventDefault in the onClick() handler in Wix, but there is no such thing (it’s a custom event)
  • set the href attribute to '' after clicking it, it still redirects (and modify the dom for some reason, the a turns into a button)