JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text">
<button>Click me!</button>

JavaScript

function handler() {
    console.log(this);
}
var but = $('button');
$('input').on('keyup', function(e) {
    if (e.which === 13) {
        but.trigger('click');
    }
});
but.on('click', handler);