views:

43

answers:

2

Hi all, thanks in advance for your help.

I'm using this piece of code to replace a circumflex a that keeps appearing in a website I'm working on, however it only replaces the first occurance of the circumflex a in a given tag.

Can anyone help me extend the code?

    $(function() {
    $('h2, h3, h4, p, a, div, body').each(function() {
        var $h = $(this);
        var html = $h.html();
        html = html.replace( 'Â', '' );
        $h.html( html );
    });
})
+2  A: 

Add the "/g" global indicator to your regular expression:

html = html.replace( /Â/g, '' );
JacobM
Lovely, thank you very much for your help.
toomanyairmiles
A: 

Try this:

html = html.replace(/Â/g, '');
Sarfraz
Downvote removed.
Jamie Wong