// check password and password confirmation input fields // used in Security and Reset Password $('#inputNewPwd, #inputConfirm').on('keyup', function () { var isBest, isMatch; isBest = checkPasswordReq($('#inputNewPwd').val()) $('#recommendation').empty(); if (!isBest) { $('#recommendation').html('Must be at least 8 characters').css('color', 'red'); } // match or not? if ($('#inputNewPwd').val() == $('#inputConfirm').val()) { $('#message').html('Matching').css('color', 'green'); isMatch = true; } else { $('#message').html('Not Matching').css('color', 'red'); isMatch = false; } // enable/disable update button if (isBest && isMatch) { $('#updateBtn').prop('disabled', false); } else { $('#updateBtn').prop('disabled', true); } });