JSFiddle - React, Tailwind, and code Playground
HTML
<span> hello this is test <span onclick="showParentText(this)">click here</span></span>
JavaScript
window.showParentText = function(obj) {
var thisText = obj.outerHTML,
parentText = obj.parentNode.innerHTML;
alert(parentText.replace(thisText, ""));
}