JS

HOW TO REDIRECT ON CLICK IN JAVASCRIPT

LOCATION.HREF - PROPERTY <input type="button" value="HREF"                  onclick="location.href='URL'"/>   LOCATION.ASSIGN() - FUNCTION <input type="button" value="ASSIGN"             onclick="location.assign('URL')"/>

LOCATION HREF & ASSIGN

01

LOCATION.REPLACE() - FUNCTION <input type="button" value="REPLACE"             onclick="location.replace('URL')"/>

LOCATION REPLACE

02

<script> function goToBookmark () {   location.hash = "bookmark";   document.getElementById("bookmark")   .scrollIntoView(); } </script>

REDIRECT SAME PAGE

03

<span onclick="goToBookmark()">   Go to bookmark </span> <span id="bookmark">   The Bookmark. </span>