Match Password and Confirm Password validation through JavaScript.
In this article I will explain you how to match Password and Confirm Password by using JavaScript.
The values of the Password and Confirm Password are compared by using JavaScript.
If both values does not match an error message will displayed on the screen.First of all If you want
to try this code you can simply run in text file through html it really works.
<table border="2" cellpadding="5" cellspacing="2">
<tr>
<td> Password: </td>
<td><input type="password" id="pass" /></td>
</tr>
<tr>
<td>Confirm Password:</td>
<td><input type="password" id="conpass" /></td>
</tr>
<tr>
<td></td>
<td><input type="button" id="btnSubmit" value="Submit" onclick="return Validate()" /></td>
</tr>
</table>
<script type="text/javascript">
function Validate() {
var pass = document.getElementById("pass").value;
var conpass = document.getElementById("conpass").value;
if (pass!= conpass {
alert("Passwords do not match.");
return false;
}
return true;
}
</script>
In this article I will explain you how to match Password and Confirm Password by using JavaScript.
The values of the Password and Confirm Password are compared by using JavaScript.
If both values does not match an error message will displayed on the screen.First of all If you want
to try this code you can simply run in text file through html it really works.
<table border="2" cellpadding="5" cellspacing="2">
<tr>
<td> Password: </td>
<td><input type="password" id="pass" /></td>
</tr>
<tr>
<td>Confirm Password:</td>
<td><input type="password" id="conpass" /></td>
</tr>
<tr>
<td></td>
<td><input type="button" id="btnSubmit" value="Submit" onclick="return Validate()" /></td>
</tr>
</table>
<script type="text/javascript">
function Validate() {
var pass = document.getElementById("pass").value;
var conpass = document.getElementById("conpass").value;
if (pass!= conpass {
alert("Passwords do not match.");
return false;
}
return true;
}
</script>
0 comments:
Post a Comment