replacing characters in entire document JQuery

javascript, jquery

Solution

Is this what you want?

$(document.documentElement).html(function(i,val){
    return val.replace(/\[/g,'<');
});

document itself is not a `DOM Element`,you should use document.documentElement instead.

Problem

I have tried a number of different approaches to this but nothing is working. Right now I have: ``` $(document).ready(function () { $(".page").click(function () { var html = $(document).html(); html.replace("[", "<"); alert("here"); }); }); ``` This refuses to work. It will also not allow me to do anything how the Jquery exmaples go for instance ``` $("[").replaceWith("<"); ``` It seems to me that .replace is not even in jQuery even though a lot of examples seem to have it as part of query. Any suggestions? This is starting to frustrate me. I have tried passing in a particular div and it still refuses to work. Any ideas? Any help would be greatly appreciated!

Original source