I do have a credit card number form. The number is divided into four parts just as on a real credit card.
I want to add a JavaScript taste to the form where when a u
If your form fields are one beside the other like in your example, you could simply take advantage of nextElementSibling and voilà!
function skipIfMax(element) {
max = parseInt(element.dataset.max)
if (element.value.length >= max && element.nextElementSibling) {
element.nextElementSibling.focus();
}
}