JSFiddle - React, Tailwind, and code Playground

HTML

<div class="example">Some Example text  
    <span id="eee"> text in the span </span>
</div>
<div class="example">Some more Example text</div>

CSS

span { color: blue; }

JavaScript

$('div').each(function() {
    $this = $(this);
    $this.html($this.html().replace(/(?!.*<.*[e]*.*>.*)e*/gi, '')); 
});