How To Stop Link Component From Scrolling To The Top?
How To Stop Link Component From Scrolling To The Top?
At a glance
The community member has a "link button" that triggers a script but also scrolls back to the top of the site, which they don't want. The comments suggest using a button component instead of a link, and using e.preventDefault() to prevent the default link behavior. The comments also discuss the difference between links and buttons, with links being for navigation and buttons being for triggering actions. The community member notes that they previously couldn't use a button but now it works with their script.
I have link "button" which doesn't go to an external website but triggers something in my script, but while it triggers my script it also scrolls back to the top of the site, but I don't want that to happen. How can I overcome this?