.replaceText only working in one instance of the word
Hello everyone. I am making a plugin (for google chrome) that replaces certain words with others and so far I have got it to work for one instance of the word in the text. For example, in the code I have below, it will replace the word "said" with "forgot" but if the text contains the word "said" more than once, it only acknowledges it once. I tries using /g and /gi and maybe I am doing it wrong but it isn't working. Could anyone point me to a solution that doesn't involve completely uprooting what I have so far?
Thank you!
var dictionary = {
said : "forgot",
};
$(document).ready(function(){
$.each(dictionary, function (key, value) {
$("body *").replaceText(key, value);
});
});