JSFiddle - React, Tailwind, and code Playground
by Fernando Leal
HTML
<input type="text" id="senha_cadastro" />
<input type="text" id="confirmarsenha_cadastro" />
JavaScript
function verificarIgual()
{
if(senha.value != confirmar.value)
{
senha.style.backgroundColor = "#FF0000";
confirmar.style.backgroundColor = "#FF0000";
}else{
senha.style.backgroundColor = "#FFFFFF";
confirmar.style.backgroundColor = "#FFFFFF";
}
}
var senha = document.getElementById('senha_cadastro');
var confirmar = document.getElementById('confirmarsenha_cadastro');
senha.onkeyup = verificarIgual;
confirmar.onkeyup = verificarIgual;