Open link to dynamic page from repeater in new page

Hi all! I have a link to dynamic page from my repeater which opens in the same page. I would like it to open in a new page when clicked. I’ve tried this code

$w.onReady(() => {
$w(“#image1”).onClick((event, $w) => {
let targetId = $w(“#dataset1”).getCurrentItem()._id;
wixLocation.to(‘/Timedout/’ + targetId) //
$w(“#image1”).target = “_blank”;
});

and this code (added Id to target)

$w.onReady(() => {
$w(“#image1”).onClick((event, $w) => {
let targetId = $w(“#dataset1”).getCurrentItem()._id;
wixLocation.to(‘/Timedout/’ + targetId) //
$w(“#image1”).targetId = “_blank”;
});

but still opens in the current window. Any ideas?

first of all, you talked about a repeater, but I don’t see any repeater in your code.
Second, you can’t mix wixLocation and target.
It should be something like:

$w("#image1").link = "xxxx";
$w("#image1").target = "_blank";

Image 1 is in a repeater and the link opens the dynamic page that displays the user submission. I was told to do the link this way so that it displayed the correct images from the submission?

if you use a repeater, so you probably want to use onItemReady( ) :
https://www.wix.com/corvid/reference/$w.Repeater.html#onItemReady
otherwise every item in the repeater will link to the same page (and not to its own dynamic page).

As I said - wixLocation and target can’t work together.