JSFiddle - React, Tailwind, and code Playground
HTML
<div class='snippet'>hello</div>
<br>
<div id='showhtml'></div>
JavaScript
var text_only = '<div>' + $('.snippet').text() + '</div>';
document.getElementById('showhtml').innerHTML = text_only;