JSFiddle - React, Tailwind, and code Playground
HTML
<div>
<ol>
#1: <pre id="normal"></pre></li>
#2: <pre id="spacesOnly"></pre></li>
</ol>
</div>
JavaScript
function htmlDecode(input){
var e = document.createElement('div');
e.innerHTML = input;
return e.childNodes[0].nodeValue;
}
$("#normal").text(htmlDecode("<img src='myimage.jpg'>"));
$("#spacesOnly").text(htmlDecode(" "));