<button onclick="redirectToGoogle()" class="google">Google Homepage</button>
<button onclick="redirectToHashnode()" class="hashnode">
Hashnode Homepage
</button>
button {
background-color: dodgerblue;
border: none;
color: white;
padding: 12px 10px;
font-size: 19px;
margin: 0rem 1rem;
cursor: pointer;
}
.hashnode {
background-color: purple;
}
function redirectToGoogle() {
window.location.assign("https://www.google.com");
}
function redirectToHashnode() {
window.location.assign("https://www.hashnode.com");
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.