Reputation: 11
I need to replace the URL in the DIV with ID "___gcse_1". I created a new function, replace_url (), but adding the domain in full does not work, as there are syntax problems. my code below:
async function sostituisco_url() {
var str = document.getElementById("___gcse_1").innerHTML;
var res = str.replace(/www.sitoweb.it//gi, "nuova_url");
document.getElementById("___gcse_1").innerHTML = res;
}
window.onload = sostituisco_url;
Upvotes: 1
Views: 205