I'm using JS to dynamically change the value of the href inside of a popup link.

The first time it pops up it works fine.

I then close that popup, re-assign the value of the href in that same anchor tag, and then I have 2 layers of popups. i.e. I click the close icon, the top layer closes, but there is still a popup. I click close again, and then the overlay dissapears.

Is there any right way to re-assign the href without a page reload to re-init popups?