how to make a button link to another page code example

Example 1: add link behind a button in html

<!DOCTYPE html>
<html>
   <head>
      <title>Title of the document</title>
   </head>
   <body>
      <form>
         <input type="button" onclick="window.location.href = 'https://www.w3docs.com';" value="w3docs"/>
      </form>
   </body>
</html>

Example 2: html button click url

# Wrap whole button in a 'a' tag.
 <a href="https://google.com" class="button"><button class="pixel">Button text</button></a>

Example 3: button with href

onClick={() => {window.location.href="https://www.golfballs.com/"}}

Tags: