JSFiddle - React, Tailwind, and code Playground
HTML
<div id="firstDiv">
This is some text
<span id="firstSpan">First span text</span>
<span id="secondSpan">Second span text</span>
</div>
JavaScript
$('#firstDiv').contents().filter(function() {
return this.nodeType===3;
}).remove();