Button links in html | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Button links in html

Can someone please tell me how to make a button that if it's clicked opens another html document in the same folder

1st Aug 2021, 12:44 PM
Nils Hecht
Nils Hecht - avatar
8 Answers
+ 2
If you really want to use a button use onclick event: <button onclick="window.location.href='/page2'">Continue</button>
1st Aug 2021, 12:51 PM
Aleksei Radchenkov
Aleksei Radchenkov - avatar
+ 2
See It Here: https://code.sololearn.com/Wa18A20A22A9 I Specially Made It For You! Hope This Helped You...
1st Aug 2021, 6:25 PM
Sancho Godinho
Sancho Godinho - avatar
+ 1
Noo HrCoder either use button or a link not together)))
1st Aug 2021, 12:48 PM
Aleksei Radchenkov
Aleksei Radchenkov - avatar
0
Bro just style a link as a button))
1st Aug 2021, 12:46 PM
Aleksei Radchenkov
Aleksei Radchenkov - avatar
0
Aleksei Radchenkov idk what you mean sorry can you explain it to me pls
1st Aug 2021, 12:46 PM
Nils Hecht
Nils Hecht - avatar
0
1st Aug 2021, 12:47 PM
Nils Hecht
Nils Hecht - avatar
- 1
<a href="example.html"><button>Example</button></a>
1st Aug 2021, 1:00 PM
Aravind Shetty
Aravind Shetty - avatar
- 1
You can use inline JavaScript for this. Eg. <button onclick="window.location.href='url'">button</button>
2nd Aug 2021, 7:10 PM
Ankit Singh
Ankit Singh - avatar