Skip to content

Instantly share code, notes, and snippets.

@fixlr
Created June 25, 2009 17:07
Show Gist options
  • Save fixlr/135994 to your computer and use it in GitHub Desktop.
Save fixlr/135994 to your computer and use it in GitHub Desktop.
function remove_a(title) {
var all = document.getElementsByTagName('a');
for (i = 0; i < all.length; i++) {
element = all[i];
if (element.title.match(title)) {
element.parentNode.removeChild(element);
}
}
}
/* This window.onload bit only needs to occur once in your HTML. It delays
* execution of the code within { } until AFTER the browser has downloaded
* all of the HTML (otherwise... putting it in the <head> might cause it to
* cause it to execute before the browser knows what the <body> contains)
*
* Another way to achieve the same thing would be to move the <script> tag to
* the end of your <body>, as Google recommends with their Analytics snippet.
*
* Can also be moved to an external file, and included with:
*
* <script src='path/to/external.js'>< /script>
*
* Feel free to remove this comment so that you don't look like a noob.
*/
window.onload = function() {
remove_a(/Subscribe\/Unsubscribe|Click to search this forum/);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment