我有一个脚本可以自动告诉人们他们的新密码何时匹配(帐户激活),但我需要找到一种方法来让它启用提交按钮。
这是我的代码:
JS:
function checkPasswordMatch() {
var password = $("#new_password").val();
var confirmPassword = $("#new_password2").val();
if (password != confirmPassword) $("#divCheckPasswordMatch").html("<font color=\"red\"><b>Check Passwords</b></font>");
else $("#divCheckPasswordMatch").html("<font color=\"green\"><b>Passwords Match</b></font>");
}
$(document).ready(function() {
$("#txtConfirmPassword").keyup(checkPasswordMatch);
});
HTML
<table>
<form action="activate_account.php" method="post">
<tr>
<td align="right">
<label for="new_password">Password (6-12 chars):</label>
</td>
<td>
<input type="password" name="new_password" id="new_password" />
</td>
</tr>
<tr>
<td align="right">
<label for="new_password2">Again:</label>
</td>
<td>
<input type="password" name="new_password2" id="new_password2" onkeyup="checkPasswordMatch();"
/>
</td>
</tr>
<tr>
<td>
<td>
<div class="registrationFormAlert" id="divCheckPasswordMatch"></div>
</td>
<td>
<div id="submit">
<input type="submit" value="Activate Account" disabled="disabled" />
</div>
</td>
</tr>
</table>