JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text">
<button>Click me!</button>
JavaScript
function handler() {
console.log('Do something');
}
$('input').on('keyup', function(e) {
if (e.which === 13) {
handler();
// или
// handler.call(this);
}
});
$('button').on('click', handler);