0
I have the following code JavaScript, how do I change the background color of the button when it is disabled?
let campoSenha = document.querySelector('input[name="senha_imob"]');
let campoConfirmarSenha = document.querySelector('input[name="rsenha_imob"]');
let botao = document.querySelector('input[name="btn-entrar"]');
    
campoSenha.addEventListener('input', function(){
    verificaCampos();
});
    
campoConfirmarSenha.addEventListener('input', function(){
    verificaCampos();
});
    
function verificaCampos() {
    if(campoSenha.value == campoConfirmarSenha.value && campoSenha.value.length > 8)
    	botao.disabled = false;
    else
    	botao.disabled = true;
}
.frm-botao {
    width: 100%;
    background-color:#EA8419;
    border:none;
    cursor:pointer;
    color:#FFFFFF;
    font-size:25px;
    font-weight:normal;
    padding: 10px;
    margin-top: 10px;
}
.frm-botao:hover {
    background-color:#C16911;
}
<input type="submit" name="btn-entrar" value="ATUALIZAR" class="frm-botao" disabled />
It would not be more interesting to change when it is enabled. Green type?
– LeAndrade
@Leandrade Very interesting, dark gray type when disabled and green when enabled. Can help me?
– Gladison
You can simply add a new class in css where the button is gray and add or remove the class from the button as it becomes active/inactive, no?
– Máttheus Spoo