With text like this:
N/A, Category
I want to get rid of every occurrenc
You need to set the text after the replace call:
$('.element span').each(function() {
console.log($(this).text());
var text = $(this).text().replace('N/A, ', '');
$(this).text(text);
});
N/A, Category
Here's another cool way you can do it (hat tip @Felix King):
$(".element span").text(function(index, text) {
return text.replace("N/A, ", "");
});