Closed signalstoerung closed 10 months ago
help from ChatGPT:
To prevent the page from scrolling to the top when clicking on a link with href="#"
, you can modify the JavaScript function to return false
. Here's an example:
<a href="#" onclick="yourJavaScriptFunction(); return false;">Link Text</a>
By adding return false;
to the onclick
attribute, it will prevent the default behavior of the link, which is to navigate to the top of the page. Your JavaScript function will still be executed, and the link will visually behave like a link.
Jumps to the top of the page