On Click Anchor

Can someone help? I am trying to have an on click event to an anchor. I want the user to click on a table and have it pull to an anchor.


For example if I have 4 anchors (anchor0, anchor1, anchor2 & anchor3) and 4 table rows, I can use the onRowSelect event to get the index of the row that the user clicked on, and use scroll.to() to navigate to the matching anchor.

See the example below:

export function table1_rowSelect(event, $w) {
	let target = event.rowIndex; //using rowIndex for example
	$w('#anchor' + target).scrollTo();