How to exclude some div form body for replace
I want to replace some content with JQuery function replace(), like this...
... var content = $("body"); content.html(content.html().replace(/([a-zA-Z])[']([a-zA-Z])/g,'$1’$2')); ...
However, I want to exclude some div, like "#foo" or "#bar".
var content = $("body") > *:not("#bar"); ... var content = $("body").find(":not(#bar)"); ...
but it doesn't work.
The only solution that works with me is to list one by one each div where to apply the expected replacement. This solution seems poor! :)
Thanks a lot for your help!
var content = $("body:not('#bar')");
Or using not() method:
var content = $("body").not('#bar');