pull/152/merge
Vishesh Singh 3 years ago committed by GitHub
commit e9255ec1ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -6,9 +6,14 @@ codes.forEach((code, idx) => {
code.addEventListener('keydown', (e) => { code.addEventListener('keydown', (e) => {
if (e.key >= 0 && e.key <= 9) { if (e.key >= 0 && e.key <= 9) {
codes[idx].value = '' codes[idx].value = ''
if (idx !== codes.length - 1) {
setTimeout(() => codes[idx + 1].focus(), 10) setTimeout(() => codes[idx + 1].focus(), 10)
}
} else if (e.key === 'Backspace') { } else if (e.key === 'Backspace') {
if (!idx - 1 < 0) {
setTimeout(() => codes[idx - 1].focus(), 10) setTimeout(() => codes[idx - 1].focus(), 10)
} }
}
}) })
}) })
Loading…
Cancel
Save