Open existing Page as a Modal

I have the case that I can only edit/add CSS and Javascript. I have an existing link with an a tag inside a classed span. If I click on the a tag, I want to open the link as a modal.

Remember, I cannot change HTML or other attributes. I am fairly new to this thing so I came here to ask.

<span class="spanclass">
  <a href="thisismylink">MyLinkTargetText</a>
</span>

I want the a href to open the same page as a modal.
Is there a solution to this?

I tried various snippets from the internet, but none seemed to work they way I want them to. Help!