Closed kunal00000 closed 1 year ago
You can merge this branch now.
I think it still needs improvement.
@DevilsAutumn review it once. on pressing keys faster it may leave boxes but while verifying codes we press it slowly. so have a look.
@DevilsAutumn review it once. on pressing keys faster it may leave boxes but while verifying codes we press it slowly. so have a look.
try this logic in your js file and see if it causes any error.
codes.forEach((code, idx) => {
code.addEventListener("keydown", (e) => {
if (e.keyCode >= 48 && e.keyCode <= 57 && codes[idx].value == "") {
setTimeout(() => codes[idx + 1].focus(), 10);
} else if (e.key === "Backspace") {
codes[idx - 1].value = "";
setTimeout(() => codes[idx - 1].focus(), 10);
} else if (e.key === "Enter") {
for (var i = 0; i < codes.length; i++) {
codes[i].value = "";
}
codes[0].focus();
} else {
codes[idx].value = "";
codes[idx].value = e.key;
e.preventDefault();
}
});
});
yes, it worked flawlessly. Thanks , I got to learn new stuffs from this. maxlength , keyup keydown , preventDefault properties and working. 👍🏻
yes, it worked flawlessly. Thanks , I got to learn new stuffs from this. maxlength , keyup keydown , preventDefault properties and working. 👍🏻
Thats great!
Description
Please include a summary of the change and which issue is fixed.
Fixes #18
Replace
issue_no
with the issue number which is fixed in this PRType of change
Please delete options that are not relevant.
Checklist:
README.md