Last active
March 1, 2017 22:39
-
-
Save brehaut/e154f395a515f1d3a0dc5741eb27d9b3 to your computer and use it in GitHub Desktop.
A bookmarklet to remove the next element clicked
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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