JSFiddle - React, Tailwind, and code Playground
HTML
<input id='p1' type="password">
<br>
<input id='p2' type="password">
<div id="_status">
</div>
CSS
div {
color: white;
}
div.good {
background: green;
}
div.bad {
background: lightsalmon;
}
JavaScript
p1.addEventListener('input', check)
p2.addEventListener('input', check)
function check() {
if (p1.value === p2.value) {
_status.textContent = "Passwords match!"
_status.className = "good"
} else {
_status.textContent = "Passwords don't match!"
_status.className = "bad"
}
}