<div class="container">
<input maxlength="10">
</div>
const container = document.querySelector('.container');
const input = container.querySelector('input').cloneNode();
container.addEventListener('input', ({ target: t }) => {
if (t.value.length === +t.maxLength) {
const nextInput = t.nextElementSibling || input.cloneNode();
t.insertAdjacentElement('afterend', nextInput);
nextInput.focus();
}
});
Переписал код с ES5 на ES6