Skip to content

Instantly share code, notes, and snippets.

@brehaut
Last active March 1, 2017 22:39
Show Gist options
  • Save brehaut/e154f395a515f1d3a0dc5741eb27d9b3 to your computer and use it in GitHub Desktop.
Save brehaut/e154f395a515f1d3a0dc5741eb27d9b3 to your computer and use it in GitHub Desktop.
A bookmarklet to remove the next element clicked
Copy the text on line 3 and paste it as the location of a new bookmark in your browser.
javascript:void (function%20()%20%7B%20%20%20%20%20function%20handler(ev)%20%7B%20%20%20%20%20%20%20%20%20document.body.removeEventListener(%22click%22,%20handler);%20%20%20%20%20%20%20%20%20%20ev.target.parentElement.removeChild(ev.target);%20%20%20%20%20%20%20%20%20ev.preventDefault();%20%20%20%20%20%20%20%20%20ev.stopPropagation();%20%20%20%20%20%7D%20%20%20%20%20%20document.body.addEventListener(%22click%22,%20handler);%20%7D)();
(function () {
function handler(ev) {
document.body.removeEventListener("click", handler);
ev.target.parentElement.removeChild(ev.target);
ev.preventDefault();
ev.stopPropagation();
}
document.body.addEventListener("click", handler);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment