JSFiddle - React, Tailwind, and code Playground
HTML
<div id="foo">yyy<span>xxx</span></div>
JavaScript
$('#foo').html($('#foo').html().replace('yyy','')).find('span').before('new content')
<div id="foo">yyy<span>xxx</span></div>
$('#foo').html($('#foo').html().replace('yyy','')).find('span').before('new content')