JSFiddle - React, Tailwind, and code Playground

HTML

<textarea id="comment" rows="3" placeholder="Insert your comment"></textarea>

CSS

body {
  padding: 1em;
}

textarea {
  width: auto;
  border-color: #ddd;
  padding: 1em;
  font-family: sans-serif;
  font-size: 16px;
}

JavaScript

function handleEvent (e) {
	if(e.keyCode === 13) {
  	e.preventDefault();
  	// Do anything.
    alert("Enter key pressed!");
  }
};

/* 
 Pure JS
 */
var comment = document.querySelector("#comment");

comment.addEventListener("keypress", handleEvent, true);

/*
 jQuery
$("#comment").on("keypress", handleEvent);
*/