JSFiddle - React, Tailwind, and code Playground
HTML
<DIV id="wrapper"></DIV>
JavaScript
var HTML='<p style="no\\\"ne" id=\'s\\\'"df\'>Text<a href="">NBC</a></p>';
var div = document.createElement("div");
div.innerHTML = HTML;
var text1 = div.textContent || div.innerText || "";
var regex= /<(?:[^"'>]+|(["'])(?:\\[\s\S]|(?!\1)[\s\S])*\1)*>/g;
var text2= HTML.replace(regex, "");
$("#wrapper").html( $(HTML).text(HTML).html()+"<br/><hr/>"+text1+"<BR/><HR/>"+text2 );