JSFiddle - React, Tailwind, and code Playground

HTML

<div>
    <span class="A"></span>6
    <span class="B"></span>8
    <span class="C"></span>3
    <span class="D"></span>9
</div>

<div id="BD"></div>

JavaScript

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

$("#BD").text(a);