Jquery 脚本密码检查问题
我正在尝试检查我的表单密码更改器上的密码,但没有对其进行排序。请参见下面的我的代码。它没有响应,提交buton steel已禁用 html:Jquery 脚本密码检查问题,jquery,html,Jquery,Html,我正在尝试检查我的表单密码更改器上的密码,但没有对其进行排序。请参见下面的我的代码。它没有响应,提交buton steel已禁用 html: <form name="resetform" action="login/change.php" id="resetform" class="passform" method="post" role="form"> <h3>Change Your Password</h3> <br />
<form name="resetform" action="login/change.php" id="resetform" class="passform" method="post" role="form">
<h3>Change Your Password</h3>
<br />
<input type="hidden" name="username" value="<?php echo $sname; ?>" ></input>
<label>Enter Old Password</label>
<input type="password" class="form-control field" name="currentPassword" id="old_password">
<label>Enter New Password</label>
<input type="password" class="form-control field" name="newPassword" id="new_password">
<label>Confirm New Password</label>
<input type="password" class="form-control field" name="con_newpassword" id="con_newpassword" />
<br>
<input type="submit" class="btn btn-primary" name="updatepass" id="submit_btn" disabled value="Change Password" />
</form>
更改密码
类名错误。。字段输入
到。密码输入
$('.passform input').keyup(function () {
var empty = false;
$('.passform input').each(function () {
if ($(this).val().length == 0) {
empty = true;
}
});
if (empty || !($('#new_password').val() === $('#con_newpassword').val())) {
$('#submit_btn').attr('disabled', 'disabled');
} else {
$('#submit_btn').attr('disabled', false);
}
});
input.field
会更好,因为选择器也会捕捉隐藏的字段和按钮
$('.passform input').keyup(function () {
var empty = false;
$('.passform input').each(function () {
if ($(this).val().length == 0) {
empty = true;
}
});
if (empty || !($('#new_password').val() === $('#con_newpassword').val())) {
$('#submit_btn').attr('disabled', 'disabled');
} else {
$('#submit_btn').attr('disabled', false);
}
});