Can't make my buttons link to an external website

I have the following code, but when I click the buttons it loads a white page:

<button class="btn btn-block btn-primary" onclick="window.location.href='https://www.facebook.com'"><i class="fa fa-facebook left">acebook</i></button>

opps here is the code —acebook

I cleaned up your code.
You need to use triple backticks to post code to the forum.
See this post for details.

Thank you, but I don’t see the cleaned up version of my mess :slight_smile:

I edited your initial post. You should see your code under: [quote=“AGFarooq, post:1, topic:99238”]
I have the following code, but when I click the buttons it loads a white page:
[/quote]

Ah I get it, I thought you had solved my link problems. Thanks for the other tip though, very useful.

Do you use CodePen or something similar? In that case window.location.href doesn’t work.

I am using Codepen and it seems like a few things don’t work in it. But the challenge asks for a button to link to your social media. Not sure how to get around it then.

You can use <a href="[your-facebook-link-here]" target="_blank">CLICK HERE FOR MY FACEBOOK</a>

The target="_blank" makes the link open in a new tab. If you want you can put your button (or any other HTML element) inside the <a></a>.

Awesome. thanks it worked.