JSFiddle - React, Tailwind, and code Playground
HTML
<div id="info">
testing<br>
newlines
</div>
<hr>
<p>JQuery:</p>
<div id="jquery"></div>
<hr>
<p>Javascript:</p>
<div id="javascript"></div>
<hr>
<p>Aert:</p>
<input id="alert" type="button" value="alert">
CSS
p { font-weight: bold; }
JavaScript
$("#info").data("html", $("#info").html());
$("#jquery").text($("#info").data("html"));
document.getElementById("javascript").textContent = $("#info").data("html");
$("#alert").click(function() { alert($("#info").data("html")) });