Direct repeater item to dynamic page

Like this:

$w(“#text47”).onClick( (event, $w) => {
let targetID = $w(“#dataset1”).getCurrentItem()[“link-mobilestorytimekit-Kit-Info-title”];
wixLocation.to(‘wixLocation.to(targetID);’+ targetID) //
} );

That didn’t work either :frowning:
And there were these errors:

There was an error in your script
The element selector function (usually $w) cannot be used before the page is ready

I successfully coded the next and previous buttons on the dynamic page, so this is everything on that page, if that makes a difference (?):

import {local} from ‘wix-storage’;

const linkField = “link-mobilestorytimekit-Kit-Info-title”; // replace this value

$w.onReady( function () {
$w(“#dataset1”).onReady(() => {
const numberOfItems = $w(“#dataset1”).getTotalCount();

$w("#dataset1").getItems(0, numberOfItems) 
  .then( (result) => {  

const dynamicPageURLs = result.items.map(item => item[linkField]);
local.setItem(‘dynamicPageURLs’, dynamicPageURLs);
} )
. catch ( (err) => {
console.log(err.code, err.message);
} );
} );
} );

$w(“#text47”).onClick( (event, $w) => {
let targetID = $w(“#dataset1”).getCurrentItem()[“link-mobilestorytimekit-Kit-Info-title”];
wixLocation.to(‘wixLocation.to(targetID);’+ targetID) //
} );