JSFiddle - React, Tailwind, and code Playground
HTML
<form id="foo" action="blah" method="get">
<input type="text" id="xxx" />
</form>
JavaScript
$('xxx').addEvent('keydown', function(e){
if(e.key == 'enter'){
e.stop();
alert("hello");
}
})