css onclick change color
<style>
.dabutton:focus {
background-color:yellow;
}
</style>
<button class="dabutton"></button> // <-- usage
css onclick change color
<style>
.dabutton:focus {
background-color:yellow;
}
</style>
<button class="dabutton"></button> // <-- usage
change the button color on click
button:active{
background-color:green;
}
javascript-change color onclick()
const btn = document.querySelector('button');
function random(number) {
return Math.floor(Math.random() * (number+1));
}
btn.onclick = function() {
const rndCol = 'rgb(' + random(255) + ',' + random(255) + ',' + random(255) + ')';
document.body.style.backgroundColor = rndCol;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us