JSFiddle - React, Tailwind, and code Playground

HTML

<p id="target">
  <span><sup>$</sup>50</span>
</p>

JavaScript

var text = $("#target span").contents().map(function() {
        if(this.nodeType == Node.TEXT_NODE){
            return $.trim(this.nodeValue);
        }
    }).toArray().join();
    alert(text);