I have multiple whole html code in variable cleanHTML and i need to strip specific tags from text.
let cleanHTML = document.documentElement.outerHTML
this:
<span class="remove-me">please</span>
<span class="remove-me">me too</span>
<span class="remove-me">and me</span>
to this:
please
me too
and me
I´m trying to do it with:
var list = cleanHTML.getElementsByClassName("remove-me");
var i;
for (i = 0; i < list.length; i++) {
list[i] = list[i].innerHTML;
}
But i´m getting error from React cleanHTML.getElementsByClassName is not a function
Any idea how to do it in a way React likes?
cleanHTMLis just a string? You could theoretically load it with axmldocparser, and then get the textContent (you don't want any html in your react jsx)>([^>]*)<?$1