JSFiddle - React, Tailwind, and code Playground
HTML
<div id="nick">
<span class="hair">leg hair</span>
<br/>
<span class="hair">head hair</span>
</div>
JavaScript
( ($)=>{
$('#nick').on('click', '.hair', function(){
const $this = $(this);
console.log( this.innerText, $this.text() ) ;
});
})(jQuery)