[SOLVED] HTML Link button redirects to YouTube.com instead of YouTube video link | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

[SOLVED] HTML Link button redirects to YouTube.com instead of YouTube video link

I’m trying to put a button that says “The Nothing button” that rickrolls you on my site. However it takes you to the YouTube homepage instead. Can someone help? ::: <form action= "https://www.youtube.com/watch?v=dQw4w9WgXcQ"> <input type="submit" value= "The nothing button" /> </form> :::

19th Aug 2022, 8:36 AM
Dev
3 Answers
0
<!-- Write the following code in the HTML file--> <!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">The Nothing button</a> </body> </html> /* Write the following code in the CSS file */ body { margin:100px; } a{ text-decoration:none; color:#000; background-color:#ccc; border-radius:5px; padding:10px; }
19th Aug 2022, 8:55 AM
Muhammad Galhoum
Muhammad Galhoum - avatar
+ 2
Is it important that you use a form? If it was only about opening the link on click, you could use a link/ anchor tag <a>
19th Aug 2022, 8:50 AM
Lisa
Lisa - avatar
+ 2
<form action="https://www.youtube.com/embed/dQw4w9WgXcQ"> <input type="submit" value= "The nothing button" /> </form>
19th Aug 2022, 8:50 AM
Jayakrishna 🇮🇳