JSFiddle - React, Tailwind, and code Playground

HTML

<form name="form1" action="filename.php" method="post">
text1: <input type="text" id="txt1" name="txt1" autofocus><br>
text2: <input type="text" id="txt2" name="txt2"><br>
text3: <input type="text" id="txt3" name="txt3"><br>
    <input type="submit" />
</form>

JavaScript

$(document).ready(function(){
    $('input').on('keypress', function(e) {
        if(e.which == 13) {           
            switch($(this).attr('id')){
                case 'txt1':
                    $('#txt2').focus();
                    e.preventDefault();
                    break;
                case 'txt2':
                    $('#txt3').focus();
                    e.preventDefault();
                    break;
            }         
        }
    });
});