Javascript code isn’t working in ios gadgets
[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]+" kind="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]+" kind="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]+" kind="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]+" kind="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]+" kind="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]+" kind="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]+" kind="quantity" id="codeBox7" onkeyup="onKeyUpEvent(7, occasion)" required></div>
</div>
The under is the javascript .
$(doc).prepared(operate () {
$(".CM-smsInput__input").on("focus", operate () {
$(this).on("keydown", operate (occasion) {
if (occasion.goal.worth > 1) {
occasion.preventDefault();
}
});
});
$(window).keydown(operate (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;
}
});
});
operate getCodeBoxElement(index) {
return doc.getElementById('codeBox' + index);
}
operate 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 programs, the otp enter subject isn’t accepting particular characters however in IOS gadgets the enter subject accepts particular characters. Unsure what to switch the code.
I’m looking for the answer and study within the course of. Thanks.
[ad_2]