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) {
if (e.keyCode === 13) {
e.preventDefault();
e.stopPropagation();
$(this).append('\n');
$(this).trigger({ type: 'keypress', which: 40});
}
});