JSFiddle - React, Tailwind, and code Playground

HTML

<span>
<h2>Joe Bloggs</h2>
Executive Director
</span>

JavaScript

alert($("span").contents().filter(function () {
    return this.nodeType === 3;
}).text().trim());