This is a follow up of my earlier question. I\'m trying to use Greasemonkey to change the text in a So the
Forget jQuery, it'll just slow your pages down.
I haven't really tested this code, but it should work maybe with some debugging: to a link that contains that text.
// ==UserScript==
// ==/UserScript==
(function() {
// collect variables
// you can change this to change which element you replace
var reference = document.querySelector('td.something>div:first-child');
var text = reference.innerText;
var replacement = text.replace(reference, "www.somewhere.com/q?=" + reference);
// create new anchor tag
var a = document.createElement('a');
a.href = replacement;
a.innerText = text;
// do the replacement
reference.innerHTML = ''; // clear the old contents of the reference
reference.appendChild(a); // append the new anchor tag into the element
})();