I there a way in javascript to make the page jump to a specific location on the page, such as
<span id='jump_to_this_location'></span>
I do not want to re=load page,
A simple and modern way to do this would be like this: document. getElementById("jump_to_this_location").
The scrollTo() method scrolls the document to specified coordinates.
Answer: Use the JavaScript window. location Property If you want to redirect the user from one page to another automatically, you can use the syntax window. location. replace("page_url") .
By prepending your href with # , you can target an HTML element with a specific id attribute. For example, <a href="#footer"> will navigate to the <div id="footer"> within the same HTML document. This type of href is often used to navigate back to the top of the page.
You can set the location.hash
property, like this:
window.location.hash = "jump_to_this_location";
You can give it a try here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With