JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" id="textbox"/>
<br/><br/>
<button>trigger</button>

JavaScript

var e = jQuery.Event("keypress");
e.which = 13; // Enter
$('textarea').trigger(e);

$('textarea').keypress(function (e) {
    if (e.which == '13') {
        alert('code');
    }
});