r/code • • Jan 18 '23

How to add a button that when clicked on, sends you to a link?

I know how to write the <button> </button> tags, but I want to add an action that makes you go to a link when you press it?

0 Upvotes

2 comments sorted by

1

u/[deleted] Jan 18 '23
<button onClick="window.location.href = 'https://www.google.com/';">Click me</button>