JSFiddle - React, Tailwind, and code Playground

by slawe

HTML

<div id="content"></div>
<textarea id="source" cols="60" rows="10">
<b>Hey, look.. this is how do you make your text bold:</b>
&lt;b&gt;this should not be bold&lt;/b&gt;
</textarea>

CSS

#content {
    border: 1px solid #aaa;
    padding: 10px;
}

JavaScript

$(function(){
    var $textarea = $("#source");
    var $editor = $("#content");
    
    $editor.html($textarea.val())
            .attr('contenteditable', true)
            .height($textarea.height());
    
    $textarea.hide();
    alert($textarea.val());
});