thanks in advan开发者_StackOverflow中文版ce 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 );
});
})
Add the "/g" global indicator to your regular expression:
html = html.replace( /Â/g, '' );
Try this:
html = html.replace(/Â/g, '');
精彩评论