console.log("updating url"); var els = document.querySelectorAll("a[href='/advertise/']"); for (var i = 0, l = els.length; i < l; i++) { var el = els[i]; el.setAttribute('href', 'https://google.com'); }