Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

navigate-to-an-anchor-on-another-page

//____________________________IN HTML_______________________________________
<section>
    <a id="section1">
        CONTENT
    </a>
</section>

<a href="different-page.html#section1">Section One</a>

//____________________________IN REACT_______________________________________
//npm i react-router-hash-link in CONSOLE
import { HashLink as Link } from 'react-router-hash-link';

<Link to="home-page#section-three">Section three</Link>
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
5+7 =