So, If I put the Mouse over the "CHANGE" button, the orange hover color works normally.
If I click the "CHANGE" button once ,the color turns red but hover color disappears (that's ok).
If I press it 2 times ,it returns to the first color(blue), but the hover color doesn't work.
How can the hover color disappear in the first click (as it does now) and reappear in the second click, as in the beginning? Thanks a lot!!!
var someFunction = {};
function changeColor() {
var button = document.getElementById('mute1').style.backgroundColor;
var color = '';
this.active = !this.active;
someFunction["one"] = this.active;
someFunction["two"] = this.active;
if (button !== 'red') {
color = 'red';
document.getElementById('mute1').style.backgroundColor = color;
document.getElementById('mute1').style.color = "#fff";
} else if (button === 'red') {
color = '#2c475c';
document.getElementById('mute1').style.backgroundColor = color;
document.getElementById('mute1').style.color = "#fff";
this.active = !this.active;
someFunction[this.function] = this.active;
}
}
#mute1 {
padding: 25px 50px;
background: #2c475c;
color: #fff;
border-radius:5px;
}
#mute1:hover {
background: orange;
}
<button id="mute1" onclick="changeColor();">CHANGE</button >