The following is a simplified excerpt from my code:
$('a').on('click', function()
{
// Get the text from the link
var textIwantToUse = $(this).text();
// Set the elements text to that of the link
$('elementIwantToPassTheTextTo').text(textIwantToUse);
}
The problem I have is the link contains a span with some text I don't want:
<a href="#">I want this text <span>but not this</span></a>
How can I remove the text in the span tag before I pass it to the target element?
Many thanks in advance.