You can use .clone() for that, like so:
b = $('div').clone();
b.children('span').remove();
alert( b.text() ); // alerts "text"
Using .clone()
we can make a copy of the div, remove the span, and then get the text, all without affecting the original DOM elements displayed on the page.