JSFiddle - React, Tailwind, and code Playground

HTML

<form onkeydown='EnterTabTest(event)' onsubmit="alert('subitting');">
    <input type='text' />
    <input type='text' />
    <input type='text' />
    <p>not part of form</p>
    <textarea></textarea>
    <select>
        <option>opt1</option>
        <option>opt2</option>
    </select>
    <p>any object</p>
    <input type='text' />
    <input type='submit' />
</form>

JavaScript

function EnterTabTest(event) 
    {
    if (!event.shiftKey && (event.target.getAttribute('type')=='submit')) return true;
    event.preventDefault();
    if (event.keyCode == 13)
        {
            if (event.shiftKey)
                $(event.target).prevAll(":input").first().focus();
            else
                $(event.target).nextAll(':input').first().focus();
        }
    return false;
    }