2
I need to do a Javascript function that changes all the words found inside a site. I tried something like:
var elements = document.getElementsByTagName('div');
for (var i = 0; i < elements.length; i++) {
var txt = elements.replace("Original","Alterada");
document.getElementsByTagName(i).element.innerHTML = txt;
}
But unfortunately it didn’t work. Several errors appear. Some solution?
Friend, perfect your answer. Thank you very much.
– user7605
For case insensitive:
.replace((new RegExp('(original)', 'gi')), "alterada")
– Kazzkiq
Thanks! I updated the answer.
– Michael Siegwarth