With text like this:
<div class="element">
<span>N/A, Category</span>
</div>
I want to get rid of every occurrence of N/A.
Here is my attempt:
$('.element span').each(function() {
console.log($(this).text());
$(this).text().replace('N/A, ', '');
});
The logged text is the text inside of the span so the selector is okay.
What am I doing wrong here?
replacereturns a string, it does not perform in place changes. And even then, the text would be set to the element automatically.