An error occurred while loading the file. Please try again.
generalFunction.js 923 bytes
// check password and password confirmation input fields
$('#inputNewPwd, #inputConfirm').on('keyup', function () {
    var isBest = false;
    var isMatch = false;
    // password best practice
    if ($('#inputNewPwd').val().length < 8) {
        $('#recommendation').html('Must be at least 8 characters').css('color', 'red');
        isBest = false;
    } else {
        $('#recommendation').html('').css('color', 'red');
        isBest = true;
    // 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);
});