Javascript code shouldn’t be working in ios units

[ad_1]

Hello I’ve the under html and javascript.

<div class="CM-smsInput" id="otp">
    <div class="CM-smsInput__control-wrapper">
    <div class="CM-smsInput__item otp"><enter minlength="1" maxlength="1" identify="code" autocomplete="off" class="CM-smsInput__input" sample="[0-9]+" sort="quantity" id="codeBox1" onkeyup="onKeyUpEvent(1, occasion)" required></div>
    <div class="CM-smsInput__item otp"><enter minlength="1" maxlength="1" identify="code" autocomplete="off" class="CM-smsInput__input" sample="[0-9]+" sort="quantity" id="codeBox2" onkeyup="onKeyUpEvent(2, occasion)" required></div>
    <div class="CM-smsInput__item otp"><enter minlength="1" maxlength="1" identify="code" autocomplete="off" class="CM-smsInput__input" sample="[0-9]+" sort="quantity" id="codeBox3" onkeyup="onKeyUpEvent(3, occasion)" required></div>
    <div class="CM-smsInput__item otp"><enter minlength="1" maxlength="1" identify="code" autocomplete="off" class="CM-smsInput__input" sample="[0-9]+" sort="quantity" id="codeBox4" onkeyup="onKeyUpEvent(4, occasion)" required></div>
    <div class="CM-smsInput__item otp"><enter minlength="1" maxlength="1" identify="code" autocomplete="off" class="CM-smsInput__input" sample="[0-9]+" sort="quantity" id="codeBox5" onkeyup="onKeyUpEvent(5, occasion)" required></div>
    <div class="CM-smsInput__item otp"><enter minlength="1" maxlength="1" identify="code" autocomplete="off" class="CM-smsInput__input" sample="[0-9]+" sort="quantity" id="codeBox6" onkeyup="onKeyUpEvent(6, occasion)" required></div>
    <div class="CM-smsInput__item otp"><enter minlength="1" maxlength="1" identify="code" autocomplete="off" class="CM-smsInput__input" sample="[0-9]+" sort="quantity" id="codeBox7" onkeyup="onKeyUpEvent(7, occasion)" required></div>
</div>   
The under is the javascript .

$(doc).prepared(perform () {
    $(".CM-smsInput__input").on("focus", perform () {
        $(this).on("keydown", perform (occasion) {
            if (occasion.goal.worth > 1) {
                occasion.preventDefault();
            }
        });
    });

    $(window).keydown(perform (occasion) {
        if (occasion.keyCode == 116 || occasion.keyCode == 93 || occasion.keyCode == 33 ||
            occasion.keyCode == 34 || occasion.keyCode == 123 || occasion.keyCode == 154 ||
            occasion.keyCode == 82 || occasion.keyCode == 17 || occasion.keyCode === 38 ||
            occasion.keyCode === 40 || occasion.keyCode === 13 
         ) {
            occasion.preventDefault();
            return false;
        }       
        
    });
});

perform getCodeBoxElement(index) {
    return doc.getElementById('codeBox' + index);
}

perform onKeyUpEvent(index, occasion) {
    const eventCode = occasion.which || occasion.keyCode;
    if (eventCode === 8) {
        $('.CM-smsInput__item').discover('enter').val('');
        getCodeBoxElement(1).focus();
        $('#btnSubmitOTP').addClass('disabled');
        return false;
    }


    if (getCodeBoxElement(index).worth.size === 1) {
        if (index !== 7) {
            getCodeBoxElement(index + 1).focus();
        } else {
            getCodeBoxElement(index).blur();
        }
    }    
    occasion.preventDefault();
    occasion.stopPropagation();
}

In Android and window techniques, the otp enter subject shouldn’t be accepting particular characters however in IOS units the enter subject accepts particular characters. Undecided what to change the code.
I’m looking for the answer and be taught within the course of. Thanks.

[ad_2]

Leave a Reply