<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>Password</td>
<td><asp:TextBox ID="txtPassword" runat="server" TextMode="Password" /></td>
</tr>
<tr>
<td>Confirm Password</td>
<td><asp:TextBox ID="txtConfirmPassword" runat="server" TextMode="Password" /></td>
</tr>
<tr>
<td></td>
<td><asp:Button ID="btnSubmit" Text="Submit" runat="server" /></td>
</tr>
</table>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
$("[id*=btnSubmit]").click(function () {
var password = $("[id*=txtPassword]").val();
var confirmPassword = $("[id*=txtConfirmPassword]").val();
if (password != confirmPassword) {
alert("Passwords do not match.");
return false;
}
return true;
});
});
</script>
Browser Compatibility
The above code has been tested in the following browsers.
* All browser logos displayed above are property of their respective owners.