Unable to Add Anchors to Sections on One Pager

Hi everyone,

I’m currently building a One Pager in Wix Editor and need to link menu items and buttons to specific sections of the page using anchors. However, I’m unable to add anchors to sections, which is preventing me from creating these links.

Interestingly, I can add anchor menus, but I don’t need that functionality—I just want to link my buttons and menu items directly to the sections.

Has anyone else faced this issue or knows how to resolve it? Any help would be greatly appreciated!

Thanks in advance!

This custom code can solve your error without anchor elements:

import wixLocation from 'wix-location-frontend'
const anchor = wixLocation.query.anchor
if (anchor) $w('#' + anchor).scrollTo()

This will react to any link like so:
https://example.com/page?anchor=elementTag
It will scroll to #elementTag as soon as the page loads


On the other hand, if you want buttons on the same page to scroll, there’s no need to handle links at all

$w('#someButton').onClick(() => $w('#someSection').scrollTo())