JSFiddle - React, Tailwind, and code Playground

HTML

<span class="main one">
    <span class="first">|first text|</span>
        <span class="main two">
            <span class="second">|second text|</span>
        </span>
    <span class="third">|third text|</span>
</span>
<br/>
<br/>
<span id="output"></span>

JavaScript

var all = $('.main').children();
console.log(all);
$('#output').text(all.text());