Problem with substring

I have a series of elements which should appear only in the printed version of the page. Before doing so, though, I need to edit some of them removing some extra chars. This is how I’ve done it:


$(".print").each(function(i) {
	$length = $(this).text().length;
	$(this).text().substring(0,$length-5);
})

If I alert the second command inside the loop I see the correct substring. However, when I preview the printed page, I still see the original string. What am I missing?

Doesn’t look like you are setting the value to the substring.

What do you mean?

You aren’t changing the original string with the edited version.

Right, thanks! :slight_smile: