+ 3
How to change button selector background that the default is blue
4 Respostas
+ 5
button {
background-color: blue;
}
0
I want, when it is off (non-active) the bg is default and when it is on clicked or dragged the bg is changed
0
maybe
button:hover{
background-color: blue;
}
0
html:
<button id="blueBtn" onclick="addClass()">Submit</button>
<script>
function addClass() {
const btn = document.getElementById('blueBtn');
btn.classList.add(bgBlue);
}
</script>
css:
.bgBlue {
background-color: blue;
}