<html>
<head>
<title>Easy Code Stuff - Password & Retype Password Validation Using JQuery</title>
<script type="text/javascript" src="jquery.js"></script>
<script>
function clearRetypePassword(){
$("#repassword").css("border","2px solid #C58917");
$("#errorspan").css("color","#C58917");
$("#errorspan").html("Retype The Password");
}
function checkPasswordMatch()
{
if($("#password").val() == $("#repassword").val()){
$("#repassword").css("border","2px solid #41A317");
$("#errorspan").css("color","#41A317");
$("#errorspan").html("Passwords Match!");
}else{
$("#repassword").css("border","2px solid #FF2400");
$("#errorspan").css("color","#FF2400");
$("#errorspan").html("Passwords Does Not Match!");
}
}
</script>
</head>
<body>
<label for="password">Password : </label>
<input type="password" id="password" onkeyup="clearRetypePassword(); return false;"><br/>
<label for="repassword">Retype Password : </label>
<input type="password" id="repassword" onkeyup="checkPasswordMatch(); return false;">
<span id="errorspan"></span>
</body>
</html>
No comments:
Post a Comment