JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" id="txt"/>
JavaScript
$(#txt).keypress(function (e) {
if (e.which == 13) {
alert('enter key is pressed');
console.log('enter key is pressed');
}
});