JSFiddle - React, Tailwind, and code Playground
HTML
<div class="one">
</div>
<textarea id="mainContent" onkeydown="TextareaAuto(this)" style="overflow:hidden">
</textarea>
CSS
.one{
width: 100px;
height: 30px;
background: red;
}
textarea{ overflow: hidden;}
JavaScript
$('.one').hide();
$(function(){
//hide show dive on enter press and on other keys hide div
$('#mainContent').on('keypress', function(e){
if (e.which == 13) {
e.preventDefault();
$('.one').show();
}
else{
$('.one').hide();
}
});
function TextareaAuto(o) {
o.style.height = "200px";
o.style.height = (2+o.scrollHeight)+"px";
}
});