JSFiddle - React, Tailwind, and code Playground

HTML

<span>
   <a>Text I want to ignore</a> 
   Text I want
</span>

JavaScript

var all_the_text = $('span').find('a').remove();
console.log( all_the_text.text() );
alert($('span').text());