проблема с проверкой пароля скрипта - PullRequest
0 голосов
/ 06 февраля 2020

Я пытаюсь проверить пароль на моем сменщике паролей формы, но не сортирую его, см. Ниже мой код, который не отвечает, и отправка 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>

скрипт:

$(document).ready(function() {
    $('.field input').keyup(function() {

        var empty = false;
        $('.field 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);
        }
    });
});
</script>

1 Ответ

0 голосов
/ 06 февраля 2020

Неверное название класса .field input до .passform input

 $('.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);
                }
            });
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...