I have a problem in this script. My function about given validation in two textbox. anybody here can help me?
My function:
<script>
window.onload = function () {
document.getElementById("pass").onchange = validatePassword;
document.getElementById("rp_pass").onchange = validatePassword;
};
function validatePassword()
{
var pass2=document.getElementById("pass").value;
var pass1=document.getElementById("rp_pass").value;
if(pass1!=pass2)
document.getElementById("rp_pass").setCustomValidity("Passwords Don't Match");
else
document.getElementById("rp_pass").setCustomValidity('');
//empty string means no validation error
}
</script>