JSFiddle - React, Tailwind, and code Playground

HTML

<span> hello this is test <span>click here</span></span>

JavaScript

$(document).ready(function(){alert($('span>span').parent('span').clone().find("span").empty().parent().text())});