JSFiddle - React, Tailwind, and code Playground
HTML
<label>Password </label> <input type="password" id="pword"><br>
<label>Confirm Password </label> <input type="password" id="confpword" onkeyup="passwordValidation(); return false;">
<span id="themessage" class="themessage"></span><br>
</div>
JavaScript
function passwordValidation(){
var username = document.getElementById("uname");
var password1 = document.getElementById("pword");
var confpword1 = document.getElementById("confpword");
var themsg = document.getElementById("themessage");
var gc = "#ff6666";
if (password1.value == confpword1.value){
themsg.style.color = gc;
themsg.innerHTML = "Passwords match";
}else{
themsg.style.color = gc;
themsg.innerHTML = "Passwords do not match";
}
}