0
我有一個表格,我檢查密碼是否相同,但我得到Unexpected end of input
錯誤。有誰可以告訴我我的錯誤在哪裏?表單驗證 - 意外的輸入結束
JS代碼:
<script>
$(document).ready(function() {
$("form").submit(function(event) {
var $form = $(this);
if($form.find('#password').val() !== $form.find('#password2').val()) {
event.preventDefault();
alert('Passwords do not match.');
}
});
</script>
和形式的html代碼:
<form name="form1" method="post" action="process_reset.php">
<img src="../images/login_icon.png" class="form-icon"/><div id="clr"></div><span style="float: left;padding-left: 10px;">
<b>Welcome admin.</b> <i>Reset your password</i></span><br/>
<input name="password" type="text" class="login-text-lbl" placeholder="password" id="password"><div id="clr"></div>
<input name="password2" type="password2" class="login-text-lbl" placeholder="repeat password" id="password2"><div id="clr"></div>
<input name="admin_id" type="text" value="<? echo $client_id; ?>" style="display: none;" id="admin_id"/>
<input type="submit" id="resetBtn" name="Submit" value="Reset password" class="login-button">
</form>