function check() { var txt2=document.getElementById("reEnter").value; var txt1=document.getElementById("password").value; if (txt1==txt2) { alert("Passwords Match"); } else { alert("Passwords doesn't match"); } }