JSFiddle - React, Tailwind, and code Playground

HTML

<div>This is Node 1<span>node 2</span>, node 3, and <span>node 4</span></div>

CSS

/* For easier visibility, colouring span tags */
span {
    background: yellow;
}

JavaScript

$('body').on('click', function(e) {
    alert('Node Text: '+$(e.target).clone().children().remove().end().text());
});