JSFiddle - React, Tailwind, and code Playground
HTML
<div contenteditable="true" class="chat_txt"></div>
CSS
.chat_txt{
color: #585757;
width: 892px;
overflow: auto;
white-space: pre-wrap;
border: 1px solid #d0d0d0;
height: 132px;
border-left: 0;
resize: none;
outline: none;
font-family: Butler;
font-size: 20px;
background:lightgray;
}
JavaScript
$('body').on('keypress', '.chat_txt', function(e) {
console.log(e.keyCode);
if (e.keyCode === 13) {
var evt = $.Event('keypress');
evt.keyCode = 40;
console.log(evt);
$('.chat_txt').trigger(evt);
e.preventDefault();
e.stopPropagation();
}
});