JSFiddle - React, Tailwind, and code Playground
HTML
<textarea id="myTextArea" placeholder="Type here, then click the button to update the div"></textarea>
<br />
<button id="dohtml">Make HTML</button>
<button id="dotext">Make Text</button>
<div id="myDiv"></div>
CSS
#myDiv {
border:solid 1px #999;
border-radius:4px;
min-height:50px;
margin-top:1em;
padding:0.5em;
}
#myTextArea {
min-width:200px;
}
JavaScript
$('#dohtml').click(function() {
var textAreaVal = $('#myTextArea').val();
$('#myDiv').html(textAreaVal);
});
$('#dotext').click(function() {
var textAreaVal = $('#myTextArea').val();
$('#myDiv').text(textAreaVal);
});