JSFiddle - React, Tailwind, and code Playground
by hicurin
HTML
<a href="#">I want this text <span>but not this</span></a>
JavaScript
// Find all of text node and wrap with bold
$('a').click(function(){
/*$(this).contents().filter(function(){ return this.nodeType === 3 }).wrap('<b></b>');*/
//var t = $(this).html().replace(/<span>.*<\/span>/ig, '');
var t = $(this).contents().filter(function(){ return this.nodeType === 3 }).text();
alert(t);
});