JSFiddle - React, Tailwind, and code Playground
HTML
<span class="sp">CLICK</span><br />
JavaScript
$('.sp').click(function() {
$('body').append(escapeHtml('рас <br /> два'));
});
function escapeHtml(text) {
var map = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": '''
};
return text.replace(/[&<>"']/g, function(m) { return map[m]; });
}