JSFiddle - React, Tailwind, and code Playground
by nevkatz
HTML
<div id="root">
</div>
JavaScript
let str = "<p>That&#39;s right! Khady knows customers want to buy eggs and that no vendors offer them nearby.</p>\n";
let root = document.querySelector('#root');
function print_sanitized(el, str) {
let docfrag = document.createElement('div');
docfrag.innerHTML = str;
el.innerHTML = docfrag.textContent;
return el;
}
print_sanitized(root, str);