Enterキーでfocus移動 (input[type=text] 限定ver
HTML
<form id="sample" action="test.php">
<input type="text" name="a" /><br>
<input type="checkbox" name="c1" /><br>
<input type="text" name="b" /><br>
<input type="checkbox" name="c2" /><br>
<input type="text" name="c" /><br>
<input type="text" name="d" /><br>
<input type="text" name="e" /><br>
</form>
<ul>
<li><a href="https://teratail.com/questions/325107">JavaScript - Js特定の要素にフォーカス移動する|teratail</a></li>
</ul>
JavaScript
document.getElementById('sample').addEventListener('keydown', function handleKeydown (event) {
var input = event.target;
if (event.code !== 'Enter' || input.tagName !== 'INPUT' || input.type !== 'text') return;
var nextInput = input.form.querySelector('input:focus~input[type=text]');
if (nextInput) nextInput.focus();
}, false);