JSFiddle - React, Tailwind, and code Playground
by mori57
HTML
<textarea id="MyTextArea" cols="20" rows="14"></textarea>
<button id="btnGo">Go</button>
<pre class="out">
</pre>
JavaScript
$.valHooks.textarea = {
get: function(elem) {
return elem.value.replace(/\r?\n/g, "\r\n");
}
};
$out = $(".out");
$txt = $("#MyTextArea");
$("#btnGo").click(function() {
console.log($txt.val());
$out.html($out.html() + $txt.val());
});