This won't work because children() doesn't recursively search through the DOM - it only gives you the immediate children.
–
Box9Dec 15 '10 at 23:14

Its not working on my page: laithwaiteswine.com $('.container').children().each(function(){$(this).text( $(this).text().replace('Laithwaites','Tiger') )}); - It is removing all the DOM or breaking it.
–
jrutterDec 16 '10 at 0:04

1

@jrutter: Not sure why that is happening to you without seeing your code. However, I have upated my solution with an alternate one using a RegExp approach ---> $('body').html( $('body').html().replace(/Tony/gi,'tiger') );
–
exoboyDec 16 '10 at 0:18

1

I tested it and it worked well even if items are nested multiple times.
–
exoboyDec 16 '10 at 0:18

Or, if you have a more specific container, use jQuery to select that child container and do the same thing.

Either way, it is sort of a shotgun approach. It will change the string in both visible text and html element attributes. A more detailed approach might be needed if the string needed to be ignored in certain locations.