Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 脚本密码检查问题_Jquery_Html - Fatal编程技术网

Jquery 脚本密码检查问题

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 />

我正在尝试检查我的表单密码更改器上的密码,但没有对其进行排序。请参见下面的我的代码。它没有响应,提交buton steel已禁用

html:

<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);
                }
            });