Kill that Element

Use this small JavaScript bookmarklet to remove any element on a web page with a single click. Gone annoying pop-up overlays and ads!

I have been playing around with bookmarklets and here is a handy one I made. If you come across and an element on the page you want to remove (e.g. an annoying overlay box) and you don’t want to bother removing it with the code inspector, add this code to your bookmarks bar to easily remove any HTML element with one click.

Try it out! Click the button below and then click on this text.

To add it as a bookmarklet, drag the below button into your bookmarks bar or copy paste the javascript into a bookmark’s URL and add “javascript:” before it.

Kill Element

Here is the code:

for(var i=0; i<(document.getElementsByTagName("a")).length; i++) {
(document.getElementsByTagName("a")[i]).style.pointerEvents = "none";
function handler(e) {
e = e || window.event;
var target = || e.srcElement; = "none";

document.removeEventListener('click', handler, false);

for(var i=0; i<(document.getElementsByTagName("a")).length; i++) {
(document.getElementsByTagName("a")[i]).style.pointerEvents = "initial";
document.addEventListener('click', handler, false);
function cursor(cur) { = cur; }

Share on FacebookTweet about this on TwitterShare on Google+Email this to someone