JSFiddle - React, Tailwind, and code Playground

HTML

<div id="editMe" contenteditable="true">
     There is some text here.
     <span id="selectThisText">This is the target text.</span>
     And some here.
</div>

JavaScript

var text = $('#selectThisText').text();

alert(text);