JSFiddle - React, Tailwind, and code Playground
HTML
<div>
DeleteText
<span>Something text</span>
<div>Something span inner text </div>
</div>
JavaScript
$(function () {
$("div:contains('DeleteText')").contents().filter(function () {
return (this.nodeType == 3 && $.trim(this.nodeValue) == 'DeleteText');
}).remove();
});