JSFiddle - React, Tailwind, and code Playground

by omnosis

HTML

<p>enter text</p>
<textarea id='text'></textarea>
<div id='target'></div>

CSS

textarea { width: 300px; height: 200px; margin-bottom: 10px; }
#target { width: 300px; height: 200px; border: 1px solid #aaa; background-color:#eee; color:#888; padding: 10px; }

JavaScript

$('#text').keyup(function(e){
      var keyed = $(this).val().replace(/[\n]/g,'<br />');
      $("#target").html(keyed);
 });