I'm trying to replace all periods with the degree symbol. Using the each method only replaces the first period inside the paragraph tag, not all of them. I'm also trying to make the periods inside the anchor tags to be ignored and not replaced, so the links won't be disrupted by my code. Can anyone help?
$('div.post').each(function(){
var $h = $(this);
$h.html( $h.html().replace( '.', '<span class="period">°<\/span>' ) );
});
Edit: I should have mentioned, I want to retain the 'period' class which makes it tricky.