Simple link needs to open in same window

Hello,
I am trying to create a link that opens in the same window.
By default links seem to be formatted _blank, opens in a new window

<a href=… target=“_self”
does nothing when clicked

Thanks for your help!

Where do you create this link? In Wix Code?

Yes wix code. Its coming from an JSON object which I use $w(…) html() to place links

Have you tried this?
$w(“#myElement”).link = “http://wix.com”;
$w(“#myElement”).target = “_blank”;

I thought $w() only refers to wix elements, not my own html? so if I had , your code wouldnt not work to touch this?

Is there a way to control the “onclick” attribute of the href tag using Wix code?

Did you guys find a solution for this? Either for combining the url with target =“_self” or controlling the “onclick” attribute to simulate a button click?