JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html>
<head>
<style>
p { color:blue; margin:8px; }
b { color:red; }
</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<p><b>Test</b> Paragraph.</p>
<p id='second'></p>
<p id='last'></p>
<p id='final'></p>
</body>
</html>
JavaScript
//it only grabbed the text,lost all the html formatting
var str = $("p:first").text();
$("#second").html(str);
$("#last").html('<b>my formatting is</b> preserved.');
$("#final").text('<b>my formatting is</b> lost and im sanitized into html entities.');