Password and Confirm Password validation through jQuery.
In this article I will explain you how to match Password and Confirm Password by using jQuery
in Html.The values of the Password and Confirm Password are compared by using jQuery.
An OnClick event handler button has been assigned when the button is click the values of textboxes
are compared with each other if values does not match an alert message box will display that there is
an error password not match.
<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" /></td>
</tr>
</table>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
$("#btnSubmit").click(function () {
var pass = $("#pass").val();
var conpass = $("#conpass").val();
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 jQuery
in Html.The values of the Password and Confirm Password are compared by using jQuery.
An OnClick event handler button has been assigned when the button is click the values of textboxes
are compared with each other if values does not match an alert message box will display that there is
an error password not match.
<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" /></td>
</tr>
</table>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
$("#btnSubmit").click(function () {
var pass = $("#pass").val();
var conpass = $("#conpass").val();
if (pass != conpass) {
alert("Passwords do not match.");
return false;
}
return true;
});
});
</script>