JSFiddle - React, Tailwind, and code Playground

HTML

<input id="text-input" />

JavaScript

$(document).keypress(function(e) {
    if (e.keyCode === 13) {
        $("<div>handler 1 : code defined above focus();</div>").appendTo("body");
    }
});

$(document).keypress(function(e) {
    if (e.keyCode === 13) {
        $("<div>handler 2 : focus();</div>").appendTo("body");
        $("#text-input").focus();
        e.preventDefault();
        e.stopImmediatePropagation();
    }
});

$(document).keypress(function(e) {
    if (e.keyCode === 13) {
        $("<div>handler 3 : will never be fired</div>").appendTo("body");
    }
});