[Solved] Use jQuery to find and replace multiple words on the page [duplicate]


You may try something like this:

var dictionary= {
"My Classes":"My Levels",
"My Class":"My Level",
"college":"university"
};

$("body *").each( function(){
    for( var ptrn in dictionary){
        $(this).text( $(this).text().replace(new RegExp(ptrn ,"g"), dictionary[ptrn] ) );
    }
});

solved Use jQuery to find and replace multiple words on the page [duplicate]