JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" class="myInput"></input>

JavaScript

var EV_ENTER_KEY = "enterKey";
function bind_events(cur_obj, e) {
    if (e.keyCode == 13) {
        $(cur_obj).trigger(EV_ENTER_KEY);
    }
}

$(".myInput").on({
    keyup: function (e) {
        bind_events(this, e);
    },
    
    "enterKey": function () {
        alert("Enter key pressed");
    }
});