JSFiddle - React, Tailwind, and code Playground

HTML

<div>
   **text to change**
   <someChild>
       text that should not change
   </someChild>
   <someChild>
       text that should not change
   </someChild>
</div>

JavaScript

$("div").contents().filter(function(){ return this.nodeType == 3; }).first().text("changed text");